|
@@ -0,0 +1,7785 @@
|
|
|
+#include "stdafx.h"
|
|
|
+#include "c2p.h"
|
|
|
+#include "des.h"
|
|
|
+
|
|
|
+/************************************************************************/
|
|
|
+/* 函数:全局的Lambda表达式[4/27/2018 Jeff];
|
|
|
+/* 描述:;
|
|
|
+/* 参数:;
|
|
|
+/* [IN] :;
|
|
|
+/* [OUT] :;
|
|
|
+/* [IN/OUT] :;
|
|
|
+/* 返回:void;
|
|
|
+/* 注意:;
|
|
|
+/* 示例:;
|
|
|
+/*
|
|
|
+/* 修改:;
|
|
|
+/* 日期:;
|
|
|
+/* 内容:;
|
|
|
+/************************************************************************/
|
|
|
+auto CusName = [](_RecordsetPtr ptr, const TCHAR* field, _variant_t val) {
|
|
|
+ // 姓名和拼音长度为20;
|
|
|
+ int nlen = _tcslen(val.bstrVal);
|
|
|
+ if (nlen > 20)
|
|
|
+ ptr->PutCollect(field, _variant_t(CString(val.bstrVal).Left(20)));
|
|
|
+ else
|
|
|
+ ptr->PutCollect(field, val);
|
|
|
+};
|
|
|
+
|
|
|
+auto VARINT = [](_variant_t var)->_variant_t {
|
|
|
+ _variant_t result = 0;
|
|
|
+ if (var.vt == VT_BSTR)
|
|
|
+ {
|
|
|
+ if (_tcscmp(var.bstrVal, _T("")) != 0)
|
|
|
+ result.intVal = _ttoi(var.bstrVal);
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+};
|
|
|
+
|
|
|
+auto VARBSTR = [](_variant_t var)->_variant_t {
|
|
|
+ if (var.vt == VT_NULL)
|
|
|
+ var.bstrVal = _T("");
|
|
|
+
|
|
|
+ return var;
|
|
|
+};
|
|
|
+
|
|
|
+auto VARDATENULL = [](_variant_t var)->_variant_t {
|
|
|
+ if (var.vt != VT_NULL && _tcscmp(var.bstrVal, _T("")) == 0)
|
|
|
+ {
|
|
|
+ var.vt = VT_DATE;
|
|
|
+ var.date = -1;
|
|
|
+ return var;
|
|
|
+ }
|
|
|
+
|
|
|
+ return String2Date(var.bstrVal);
|
|
|
+};
|
|
|
+
|
|
|
+auto DATENULL = [](_RecordsetPtr &set, TCHAR *pId, _variant_t var) {
|
|
|
+ if (var.vt != VT_NULL && var.vt != VT_EMPTY && _tcscmp(var.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ DATE dt = String2Date(var.bstrVal);
|
|
|
+
|
|
|
+ if (dt > 0) //1899年;
|
|
|
+ set->PutCollect(pId, String2Date(var.bstrVal));
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+auto DATENULL2 = [](_RecordsetPtr &set, TCHAR *pId, _variant_t var) {
|
|
|
+ if (var.vt != VT_NULL && var.vt != VT_EMPTY && _tcscmp(var.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ COleDateTime curdate = COleDateTime::GetCurrentTime();
|
|
|
+ DATE dt = String2Date(var.bstrVal);
|
|
|
+
|
|
|
+ if (dt > 0)
|
|
|
+ { //1899年;
|
|
|
+ if (dt < curdate.m_dt)
|
|
|
+ set->PutCollect(pId, String2Date(var.bstrVal));
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+auto PRICENULL = [](_RecordsetPtr &set, TCHAR *pId, _variant_t var) {
|
|
|
+ if (var.vt != VT_NULL && var.vt != VT_EMPTY && _tcscmp(var.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ if (_tcslen(var.bstrVal) > 8)
|
|
|
+ set->PutCollect(pId, 0);
|
|
|
+ else
|
|
|
+ set->PutCollect(pId, _ttof(var.bstrVal));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ set->PutCollect(pId, 0);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+auto MKDIR = [](LPCTSTR dir) {
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ // 创建目录;
|
|
|
+ int nleft = 0;
|
|
|
+ int nIndex = -1;
|
|
|
+ TString strdir = dir;
|
|
|
+
|
|
|
+ if (strdir.at(strdir.size() - 1) != _T('\\'))
|
|
|
+ strdir.append(_T("\\"));
|
|
|
+
|
|
|
+ // 共享路径和硬盘盘符;
|
|
|
+ if (_tcscmp(strdir.substr(0, 2).c_str(), _T("\\\\")) == 0)
|
|
|
+ nleft = strdir.find_first_of(_T("\\"), 2) + 1; // 去除共享主机名;
|
|
|
+ else if (strdir.at(2) == _T('\\'))
|
|
|
+ nleft = 3;
|
|
|
+
|
|
|
+ do
|
|
|
+ {
|
|
|
+ nIndex = strdir.substr(nleft, -1).find_first_of(_T("\\"));
|
|
|
+
|
|
|
+ if (nIndex != TString::npos)
|
|
|
+ {
|
|
|
+ if (_tmkdir(strdir.substr(0, nIndex + nleft).c_str()) == -1 && (errno != EEXIST))
|
|
|
+ {
|
|
|
+ WriteTextLog(_T("创建目录失败:%s,错误码:%d"), strdir.substr(0, nIndex + nleft).c_str(), errno);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ nleft += nIndex + 1;
|
|
|
+ }
|
|
|
+ } while (nIndex != -1);
|
|
|
+};
|
|
|
+
|
|
|
+// from 和 to, 不要以 '\\'结尾;
|
|
|
+auto COPYFOLDER = [](LPCTSTR from, LPCTSTR to)->BOOL {
|
|
|
+ if (to == NULL || from == NULL || !PathFileExists(from))
|
|
|
+ return FALSE;
|
|
|
+
|
|
|
+ // 创建目录;
|
|
|
+ MKDIR(to);
|
|
|
+
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ // 复制文件;
|
|
|
+ filehelpImpl filehelper;
|
|
|
+ STR_VEC vtfiles;
|
|
|
+
|
|
|
+ if (filehelper.getfiles_findin_subfolder(from, _T("*.*"), &vtfiles))
|
|
|
+ {
|
|
|
+ int nIndex = 0;
|
|
|
+ TString strnew;
|
|
|
+
|
|
|
+ for (TString file : vtfiles)
|
|
|
+ {
|
|
|
+ strnew = file;
|
|
|
+ nIndex = strnew.find_last_of(_T('\\'));
|
|
|
+
|
|
|
+ if (nIndex != TString::npos)
|
|
|
+ {
|
|
|
+ // 是否是ok,modifytime文件;
|
|
|
+ if (_tcsicmp(strnew.substr(nIndex + 1, -1).c_str(), _T("ok")) == 0 || _tcsicmp(strnew.substr(nIndex + 1, -1).c_str(), _T("modifytime")) == 0 || _tcsicmp(strnew.substr(nIndex + 1, -1).c_str(), _T("thumbs.db")) == 0)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 是否是s,或m文件;
|
|
|
+ if (strnew.substr(nIndex + 1, -1).at(0) == _T('s') || strnew.substr(nIndex + 1, -1).at(0) == _T('m'))
|
|
|
+ {
|
|
|
+ strnew.erase(nIndex + 1, 1);
|
|
|
+
|
|
|
+ bool bexists = false;
|
|
|
+
|
|
|
+ for (TString item : vtfiles)
|
|
|
+ {
|
|
|
+ //if (strnew.compare(item) == 0 )
|
|
|
+ if (_tcsicmp(strnew.c_str(), item.c_str()) == 0)
|
|
|
+ { // 不区分大小写;
|
|
|
+ bexists = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (bexists)
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ strnew = to;
|
|
|
+ nIndex = file.find(from);
|
|
|
+
|
|
|
+ if (nIndex != TString::npos)
|
|
|
+ {
|
|
|
+ // 复制文件;
|
|
|
+ strnew.append(file.substr(nIndex + _tcslen(from)));
|
|
|
+ nIndex = strnew.find_last_of(_T('\\'));
|
|
|
+ strnew.insert(nIndex + 1, _T("Original_"));
|
|
|
+ // mkdir;
|
|
|
+ nIndex = strnew.find_last_of(_T('\\'));
|
|
|
+ MKDIR(strnew.substr(0, nIndex).c_str());
|
|
|
+
|
|
|
+ // copy;
|
|
|
+ if (CopyFile(file.c_str(), strnew.c_str(), FALSE) == FALSE)
|
|
|
+ {
|
|
|
+ DWORD dwError = GetLastError();
|
|
|
+ WriteTextLog(_T("%s=>%s,%s"), file.c_str(), strnew.c_str(), GetErrorInfo(dwError));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return TRUE;
|
|
|
+};
|
|
|
+
|
|
|
+auto RENAMEFILE = [](CString from, CString to)->BOOL {
|
|
|
+ SHFILEOPSTRUCT FileOp = { 0 };
|
|
|
+ FileOp.fFlags = FOF_NOCONFIRMATION; //不出现确认对话框
|
|
|
+ FileOp.pFrom = from + _T("/0/0");
|
|
|
+ FileOp.pTo = to + _T("/0/0");
|
|
|
+ FileOp.wFunc = FO_RENAME;
|
|
|
+ int nResult = SHFileOperation(&FileOp);
|
|
|
+
|
|
|
+ if (nResult != 0)
|
|
|
+ {
|
|
|
+ WriteTextLog(_T("复制文件夹出错:%ld,%ld"), nResult, GetLastError());
|
|
|
+ }
|
|
|
+
|
|
|
+ return nResult == 0;
|
|
|
+};
|
|
|
+
|
|
|
+#define AddColumn _T(" IF NOT EXISTS (SELECT * FROM sys.syscolumns WHERE id = OBJECT_ID(N'[dbo].[%s]') AND name = N'%s') \
|
|
|
+ALTER TABLE [dbo].[%s] ADD %s ")
|
|
|
+
|
|
|
+c2p::c2p() : m_pClassicConnection(nullptr), m_pPlatinumConnection(nullptr)
|
|
|
+{
|
|
|
+ m_strClassicDomain = _T("");
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+c2p::~c2p()
|
|
|
+{
|
|
|
+ if (m_pPlatinumConnection != nullptr) m_pPlatinumConnection->Close(), m_pPlatinumConnection.Release(), m_pPlatinumConnection = nullptr;
|
|
|
+
|
|
|
+ if (m_pClassicConnection != nullptr) m_pClassicConnection->Close(), m_pClassicConnection.Release(), m_pClassicConnection = nullptr;
|
|
|
+
|
|
|
+ ::CoUninitialize();
|
|
|
+}
|
|
|
+
|
|
|
+bool c2p::InitAdoClassic()
|
|
|
+{
|
|
|
+ if (m_pClassicConnection == nullptr)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ m_pClassicConnection.CreateInstance(__uuidof(Connection));
|
|
|
+ m_pClassicConnection->PutConnectionTimeout(60);
|
|
|
+ HRESULT hr = m_pClassicConnection->Open(_bstr_t(g_szAdoClassicConnectString), "", "", adModeUnknown);
|
|
|
+
|
|
|
+ return SUCCEEDED(hr);
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("经典版初始化:%08lx,%s,%s,%s"), e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+}
|
|
|
+
|
|
|
+bool c2p::InitAdoPlatinum()
|
|
|
+{
|
|
|
+ if (m_pPlatinumConnection == nullptr)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ m_pPlatinumConnection.CreateInstance(__uuidof(Connection));
|
|
|
+ m_pPlatinumConnection->PutConnectionTimeout(60);
|
|
|
+ HRESULT hr = m_pPlatinumConnection->Open(_bstr_t(g_szAdoPlatinumConnectString), "", "", adModeUnknown);
|
|
|
+
|
|
|
+ return SUCCEEDED(hr);
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("铂金版初始化:%08lx,%s,%s,%s"), e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::MustAlterPlatinum()
|
|
|
+{
|
|
|
+ if (m_pPlatinumConnection)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ CString strSql = _T("");
|
|
|
+#if 0// 错误方式留记;
|
|
|
+ // 执行某些非查询的sql语句不能用下面代码;
|
|
|
+ CString strSql = _T("");
|
|
|
+ VARIANT RecordsAffected;
|
|
|
+ m_pPlatinumConnection->Execute(_T("ALTER TABLE [tb_ErpOrder] ALTER COLUMN [Ord_Remark][nvarchar](max) NULL"), &RecordsAffected, adCmdUnknown);
|
|
|
+
|
|
|
+ // 插入字段c2p_order;
|
|
|
+ strSql.Format(AddColumn, _T("tb_ErpCustomerGroup"), _T("c2p_order"), _T("tb_ErpCustomerGroup"), _T("[c2p_order][nvarchar](50) NULL"));
|
|
|
+ m_pPlatinumConnection->Execute(_bstr_t(strSql), &RecordsAffected, adCmdUnknown);
|
|
|
+#endif
|
|
|
+ _CommandPtr m_pCommand;
|
|
|
+ m_pCommand.CreateInstance(__uuidof(Command));
|
|
|
+ // 将库连接赋于它;
|
|
|
+ m_pCommand->ActiveConnection = m_pPlatinumConnection;
|
|
|
+ // SQL语句;
|
|
|
+ m_pCommand->CommandText = _T("ALTER TABLE [tb_ErpOrder] ALTER COLUMN [Ord_Remark][nvarchar](max) NULL");
|
|
|
+ // 执行SQL语句,返回记录集
|
|
|
+ m_pRecordset = m_pCommand->Execute(NULL, NULL, adCmdText);
|
|
|
+
|
|
|
+ // SQL语句;
|
|
|
+ strSql.Format(AddColumn, _T("tb_ErpCustomerGroup"), _T("c2p_order"), _T("tb_ErpCustomerGroup"), _T("[c2p_order][nvarchar](50) NULL"));
|
|
|
+ m_pCommand->CommandText = _bstr_t(strSql);
|
|
|
+ // 执行SQL语句,返回记录集
|
|
|
+ m_pRecordset = m_pCommand->Execute(NULL, NULL, adCmdText);
|
|
|
+
|
|
|
+ // SQL语句;
|
|
|
+ m_pCommand->CommandText = _T("ALTER TABLE [tb_ErpCustomer] ALTER COLUMN [Cus_QQ][nvarchar](30) NULL");
|
|
|
+ // 执行SQL语句,返回记录集
|
|
|
+ m_pRecordset = m_pCommand->Execute(NULL, NULL, adCmdText);
|
|
|
+
|
|
|
+ //[tb_ErpPayment]
|
|
|
+ // SQL语句;
|
|
|
+ strSql.Format(AddColumn, _T("tb_ErpPayment"), _T("c2p_order"), _T("tb_ErpPayment"), _T("[c2p_order][nvarchar](50) NULL"));
|
|
|
+ m_pCommand->CommandText = _bstr_t(strSql);
|
|
|
+ // 执行SQL语句,返回记录集
|
|
|
+ m_pRecordset = m_pCommand->Execute(NULL, NULL, adCmdText);
|
|
|
+
|
|
|
+ strSql.Format(AddColumn, _T("tb_ErpProduct"), _T("c2p_spid"), _T("tb_ErpProduct"), _T("[c2p_spid][nvarchar](50) NULL"));
|
|
|
+ m_pCommand->CommandText = _bstr_t(strSql);
|
|
|
+ // 执行SQL语句,返回记录集
|
|
|
+ m_pRecordset = m_pCommand->Execute(NULL, NULL, adCmdText);
|
|
|
+
|
|
|
+ strSql.Format(AddColumn, _T("tb_ErpOrder"), _T("c2p_status"), _T("tb_ErpOrder"), _T("[c2p_status][int] NULL"));//用于是否转相片;
|
|
|
+ m_pCommand->CommandText = _bstr_t(strSql);
|
|
|
+ // 执行SQL语句,返回记录集
|
|
|
+ m_pRecordset = m_pCommand->Execute(NULL, NULL, adCmdText);
|
|
|
+
|
|
|
+ // tb_ErpOrder;
|
|
|
+ strSql.Format(AddColumn, _T("tb_ErpOrder"), _T("c2p_order"), _T("tb_ErpOrder"), _T("[c2p_order][nvarchar](50) NULL"));
|
|
|
+ m_pCommand->CommandText = _bstr_t(strSql);
|
|
|
+ // 执行SQL语句,返回记录集
|
|
|
+ m_pRecordset = m_pCommand->Execute(NULL, NULL, adCmdText);
|
|
|
+
|
|
|
+ // 增加字段c2p_jdid;
|
|
|
+ strSql.Format(AddColumn, _T("tb_ErpTheScenery"), _T("c2p_jdid"), _T("tb_ErpTheScenery"), _T("[c2p_jdid][nvarchar](30) NULL"));
|
|
|
+ m_pCommand->CommandText = _bstr_t(strSql);
|
|
|
+ // 执行SQL语句,返回记录集
|
|
|
+ m_pRecordset = m_pCommand->Execute(NULL, NULL, adCmdText);
|
|
|
+
|
|
|
+ // 增加字段c2p_taoxiid;
|
|
|
+ strSql.Format(AddColumn, _T("tb_ErpPackages"), _T("c2p_taoxiid"), _T("tb_ErpPackages"), _T("[c2p_taoxiid][nvarchar](50) NULL"));
|
|
|
+ m_pCommand->CommandText = _bstr_t(strSql);
|
|
|
+ // 执行SQL语句,返回记录集
|
|
|
+ m_pRecordset = m_pCommand->Execute(NULL, NULL, adCmdText);
|
|
|
+
|
|
|
+ // 插入字段c2p_order;
|
|
|
+ strSql.Format(AddColumn, _T("tb_ErpOrder"), _T("c2p_order"), _T("tb_ErpOrder"), _T("[c2p_order][nvarchar](50) NULL"));
|
|
|
+ m_pCommand->CommandText = _bstr_t(strSql);
|
|
|
+ // 执行SQL语句,返回记录集
|
|
|
+ m_pRecordset = m_pCommand->Execute(NULL, NULL, adCmdText);
|
|
|
+
|
|
|
+ // SQL语句;
|
|
|
+ m_pCommand->CommandText = _T("ALTER TABLE [tb_ErpOrderDigital] ALTER COLUMN [Ordv_LookDesignClaim][nvarchar](2048) NULL");
|
|
|
+ // 执行SQL语句,返回记录集
|
|
|
+ m_pRecordset = m_pCommand->Execute(NULL, NULL, adCmdText);
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (m_pClassicConnection)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ CString strSql = _T("");
|
|
|
+ _CommandPtr pCommand;
|
|
|
+ pCommand.CreateInstance(__uuidof(Command));
|
|
|
+ pCommand->ActiveConnection = m_pClassicConnection;
|
|
|
+
|
|
|
+ strSql.Format(AddColumn, _T("dindan"), _T("c2p_status"), _T("dindan"), _T("[c2p_status][int] NULL"));//用于是否转相片;
|
|
|
+ pCommand->CommandText = _bstr_t(strSql);
|
|
|
+ // 执行SQL语句,返回记录集
|
|
|
+ pCommand->Execute(NULL, NULL, adCmdText);
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+_variant_t c2p::c2pGetEmployeeId(_variant_t employeeName)
|
|
|
+{
|
|
|
+ CString strSql;
|
|
|
+ _RecordsetPtr rs;
|
|
|
+ rs.CreateInstance(__uuidof(Recordset));
|
|
|
+ strSql.Format(_T("select User_EmployeeID from tb_ErpUser where User_Name = '%s'"), employeeName.bstrVal);
|
|
|
+ HRESULT hr = rs->Open(_bstr_t(strSql), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockReadOnly, adCmdText);
|
|
|
+
|
|
|
+ if (FAILED(hr) || rs->adoEOF == VARIANT_TRUE)
|
|
|
+ {
|
|
|
+ rs->Close();
|
|
|
+ return _variant_t();//如果要返回空的使用_variant_t();不要返回VT_NULL,这样会赋值;
|
|
|
+ }
|
|
|
+
|
|
|
+ _variant_t var = rs->GetCollect(_T("User_EmployeeID"));
|
|
|
+ rs->Close();
|
|
|
+
|
|
|
+ return var;
|
|
|
+}
|
|
|
+
|
|
|
+_variant_t c2p::c2pGetGroupId(_variant_t & c2p_order)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ CString strSql;
|
|
|
+ _RecordsetPtr rsGroup;
|
|
|
+ rsGroup.CreateInstance(__uuidof(Recordset));
|
|
|
+ strSql.Format(_T("select * from tb_ErpCustomerGroup where GP_OrderNumber = '%s%s'"), Global::g_szClassicBranchId, c2p_order.bstrVal);
|
|
|
+ HRESULT hr = rsGroup->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockReadOnly, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ if (rsGroup->adoEOF == VARIANT_TRUE)
|
|
|
+ return _variant_t();//如果要返回空的使用_variant_t();不要返回VT_NULL,这样会赋值;
|
|
|
+
|
|
|
+ return rsGroup->GetCollect(_T("GP_CustomerGroupID"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+
|
|
|
+ return _variant_t();
|
|
|
+}
|
|
|
+
|
|
|
+_variant_t c2p::c2pGetCustomerId(_variant_t & varTelphone)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ CString strSql;
|
|
|
+ _RecordsetPtr rsCustomer;
|
|
|
+ // 创建实例;
|
|
|
+ rsCustomer.CreateInstance(__uuidof(Recordset));
|
|
|
+ // 打开实例;
|
|
|
+ strSql.Format(_T("SELECT * FROM [tb_ErpCustomer] WHERE Cus_Telephone = '%s'"), varTelphone.bstrVal);
|
|
|
+ HRESULT hr = rsCustomer->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockReadOnly, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ if (rsCustomer->adoEOF == VARIANT_TRUE)
|
|
|
+ {
|
|
|
+ rsCustomer->Close();
|
|
|
+ return _variant_t();//如果要返回空的使用_variant_t();不要返回VT_NULL,这样会赋值;
|
|
|
+ }
|
|
|
+
|
|
|
+ _variant_t CustomerId = rsCustomer->GetCollect(_T("Cus_CustomerNumber"));
|
|
|
+ rsCustomer->Close();
|
|
|
+ return CustomerId;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+
|
|
|
+ return _variant_t();
|
|
|
+}
|
|
|
+
|
|
|
+_variant_t c2p::c2pGetProductId(_variant_t & varGoodsName)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ CString strSql;
|
|
|
+ _RecordsetPtr rsGoods;
|
|
|
+ // 创建实例;
|
|
|
+ rsGoods.CreateInstance(__uuidof(Recordset));
|
|
|
+ // 打开实例;
|
|
|
+ strSql.Format(_T("SELECT * FROM [tb_ErpProduct] WHERE Prod_Name = '%s'"), varGoodsName.bstrVal);
|
|
|
+ HRESULT hr = rsGoods->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockReadOnly, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ if (rsGoods->adoEOF == VARIANT_TRUE)
|
|
|
+ {
|
|
|
+ rsGoods->Close();
|
|
|
+ return _variant_t();//如果要返回空的使用_variant_t();不要返回VT_NULL,这样会赋值;
|
|
|
+ }
|
|
|
+
|
|
|
+ _variant_t GoodId = rsGoods->GetCollect(_T("Prod_Number"));
|
|
|
+ rsGoods->Close();
|
|
|
+ return GoodId;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+
|
|
|
+ return _variant_t();
|
|
|
+}
|
|
|
+
|
|
|
+_variant_t c2p::c2pGetOrderProductUId(_variant_t & varGoodsName, _variant_t &varViceNumber)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ CString strSql;
|
|
|
+ _RecordsetPtr rsGoods;
|
|
|
+ // 创建实例;
|
|
|
+ rsGoods.CreateInstance(__uuidof(Recordset));
|
|
|
+ // 打开实例;
|
|
|
+ strSql.Format(_T("SELECT * FROM [tb_ErpOrderProductList] WHERE OPlist_ViceNumber = '%s' and OPlist_ProdName = '%s'"), varViceNumber.bstrVal, varGoodsName.bstrVal);
|
|
|
+ HRESULT hr = rsGoods->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockReadOnly, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ if (rsGoods->adoEOF == VARIANT_TRUE)
|
|
|
+ {
|
|
|
+ rsGoods->Close();
|
|
|
+ return _variant_t();//如果要返回空的使用_variant_t();不要返回VT_NULL,这样会赋值;
|
|
|
+ }
|
|
|
+
|
|
|
+ _variant_t GoodUId = rsGoods->GetCollect(_T("OPlist_UniquelyIdentity"));
|
|
|
+ rsGoods->Close();
|
|
|
+ return GoodUId;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+
|
|
|
+ return _variant_t();
|
|
|
+}
|
|
|
+
|
|
|
+_variant_t c2p::c2pGetPaymentMethodClass(_variant_t & varPaymentName)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ CString strSql;
|
|
|
+ _RecordsetPtr rsPayment;
|
|
|
+ // 创建实例;
|
|
|
+ rsPayment.CreateInstance(__uuidof(Recordset));
|
|
|
+ // 打开实例;
|
|
|
+ strSql.Format(_T("SELECT * FROM [tb_ErpSystemCategory] WHERE Sc_ClassCode = 'BEBACCAFCCEAGAIHH' and Sc_ClassName = '%s'"), varPaymentName.bstrVal);
|
|
|
+ HRESULT hr = rsPayment->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockReadOnly, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ if (rsPayment->adoEOF == VARIANT_TRUE)
|
|
|
+ {
|
|
|
+ rsPayment->Close();
|
|
|
+ return _variant_t();//如果要返回空的使用_variant_t();不要返回VT_NULL,这样会赋值;
|
|
|
+ }
|
|
|
+
|
|
|
+ _variant_t paymentClass = rsPayment->GetCollect(_T("Sc_ClassCode"));
|
|
|
+ rsPayment->Close();
|
|
|
+ return paymentClass;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+
|
|
|
+ return _variant_t();
|
|
|
+}
|
|
|
+
|
|
|
+_variant_t c2p::c2pGetScenicSpotByViceNumber(_variant_t & varViceNumber)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ CString strSql;
|
|
|
+ _RecordsetPtr rsScenicSpot;
|
|
|
+ // 创建实例;
|
|
|
+ rsScenicSpot.CreateInstance(__uuidof(Recordset));
|
|
|
+ // 打开实例;
|
|
|
+ strSql.Format(_T("SELECT * FROM [tb_ErpOrdersPhotography] WHERE Ordpg_ViceNumber = '%s'"), varViceNumber.bstrVal);
|
|
|
+ HRESULT hr = rsScenicSpot->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockReadOnly, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ if (rsScenicSpot->adoEOF == VARIANT_TRUE)
|
|
|
+ {
|
|
|
+ rsScenicSpot->Close();
|
|
|
+ return _variant_t();//如果要返回空的使用_variant_t();不要返回VT_NULL,这样会赋值;
|
|
|
+ }
|
|
|
+
|
|
|
+ _variant_t ScenicSpot = rsScenicSpot->GetCollect(_T("Ordpg_Sights"));
|
|
|
+ rsScenicSpot->Close();
|
|
|
+ return ScenicSpot;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+
|
|
|
+ return _variant_t();
|
|
|
+}
|
|
|
+
|
|
|
+_variant_t c2p::c2pGetOrderStatus(_variant_t & c2p_order)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ CString strSql;
|
|
|
+ _RecordsetPtr rsOrder;
|
|
|
+ // 创建实例;
|
|
|
+ rsOrder.CreateInstance(__uuidof(Recordset));
|
|
|
+ // 打开实例;
|
|
|
+ strSql.Format(_T("SELECT * FROM [tb_ErpOrder] WHERE Ord_Number = '%s%s'"), Global::g_szClassicBranchId, c2p_order.bstrVal);
|
|
|
+ HRESULT hr = rsOrder->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockReadOnly, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ if (rsOrder->adoEOF == VARIANT_TRUE)
|
|
|
+ {
|
|
|
+ rsOrder->Close();
|
|
|
+ return _variant_t();//如果要返回空的使用_variant_t();不要返回VT_NULL,这样会赋值;
|
|
|
+ }
|
|
|
+
|
|
|
+ _variant_t varStatus = rsOrder->GetCollect(_T("c2p_status"));
|
|
|
+ rsOrder->Close();
|
|
|
+ return varStatus;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+
|
|
|
+ return _variant_t();
|
|
|
+}
|
|
|
+
|
|
|
+_variant_t c2p::c2pGetOrderNumber(_variant_t & varClassicOrder)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ CString strSql;
|
|
|
+ CString strOrderNumber;
|
|
|
+ _RecordsetPtr rsOrder;
|
|
|
+ // 创建实例;
|
|
|
+ rsOrder.CreateInstance(__uuidof(Recordset));
|
|
|
+ // 打开实例;
|
|
|
+ strOrderNumber.Format(_T("%s%s"), Global::g_szClassicBranchId, varClassicOrder.bstrVal);
|
|
|
+ strSql.Format(_T("SELECT Ord_Number FROM [tb_ErpOrder] WHERE Ord_Number = '%s'"), strOrderNumber);
|
|
|
+ HRESULT hr = rsOrder->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenForwardOnly, adLockReadOnly, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ if (rsOrder->adoEOF == VARIANT_TRUE)
|
|
|
+ {
|
|
|
+ rsOrder->Close();
|
|
|
+ return _variant_t();//如果要返回空的使用_variant_t();不要返回VT_NULL,这样会赋值;
|
|
|
+ }
|
|
|
+
|
|
|
+ _variant_t varOrderNumber = rsOrder->GetCollect(_T("Ord_Number"));
|
|
|
+ rsOrder->Close();
|
|
|
+ return varOrderNumber;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+
|
|
|
+ return _variant_t();
|
|
|
+}
|
|
|
+
|
|
|
+bool c2p::c2pOrderNumberExists(_variant_t & varPlatinumOrder)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ bool result = false;
|
|
|
+ CString strSql;
|
|
|
+ _RecordsetPtr rsOrder;
|
|
|
+ // 创建实例;
|
|
|
+ rsOrder.CreateInstance(__uuidof(Recordset));
|
|
|
+ // 打开实例;
|
|
|
+ strSql.Format(_T("SELECT Ord_Number FROM [tb_ErpOrder] WHERE Ord_Number = '%s'"), varPlatinumOrder.bstrVal);
|
|
|
+ HRESULT hr = rsOrder->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenForwardOnly, adLockReadOnly, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ if (rsOrder->adoEOF == VARIANT_TRUE)
|
|
|
+ result = false;
|
|
|
+ else
|
|
|
+ result = true;
|
|
|
+
|
|
|
+ rsOrder->Close();
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+}
|
|
|
+
|
|
|
+_RecordsetPtr c2p::c2pQueryExspcits(CString strSql, _ConnectionPtr pConnection)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ VARIANT RecordsAffected;
|
|
|
+ _CommandPtr pCommand;
|
|
|
+ pCommand.CreateInstance(__uuidof(Command));
|
|
|
+ pCommand->ActiveConnection = pConnection;
|
|
|
+ pCommand->CommandText = _bstr_t(strSql);
|
|
|
+ return pCommand->Execute(NULL, NULL, adCmdText);
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+
|
|
|
+ return _RecordsetPtr();
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pOrderSingles(_variant_t & varOrder, _variant_t & varEmployeeId, _variant_t & varEmployeeId2, _RecordsetPtr pcRecordSet)
|
|
|
+{
|
|
|
+ CString strSql;
|
|
|
+ _variant_t RecordsAffected;
|
|
|
+ _variant_t ren = pcRecordSet->GetCollect(_T("ren"));
|
|
|
+ _variant_t ren2 = pcRecordSet->GetCollect(_T("ren2"));
|
|
|
+ _variant_t time = pcRecordSet->GetCollect(_T("time1"));
|
|
|
+
|
|
|
+ // 主门市;
|
|
|
+ if (ren.vt != VT_NULL && ren.vt != VT_EMPTY && _tcscmp(ren.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ if (varEmployeeId.vt != VT_NULL && varEmployeeId.vt != VT_EMPTY && _tcscmp(varEmployeeId.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ strSql.Format(_T("select * from tb_ErpOrdersPerson where OrdPe_Type = '0' and OrdPe_OrderNumber='%s' and OrdPe_OrdersPerson='%s'"), varOrder.bstrVal, varEmployeeId.bstrVal);
|
|
|
+ _RecordsetPtr result = c2pQueryExspcits(strSql, m_pPlatinumConnection);
|
|
|
+
|
|
|
+ if (result == NULL || result->adoEOF == VARIANT_TRUE)
|
|
|
+ {
|
|
|
+ // 有些订单的员工,可以被删除了;
|
|
|
+ strSql.Format(_T("insert tb_ErpOrdersPerson(OrdPe_OrderNumber,\
|
|
|
+ OrdPe_OrdersPerson,OrdPe_Type,OrdPe_CreateDateTime) \
|
|
|
+ values('%s','%s','0','%s')"),
|
|
|
+ varOrder.bstrVal, varEmployeeId.bstrVal, time.bstrVal);
|
|
|
+ m_pRecordset = m_pPlatinumConnection->Execute(_bstr_t(strSql), &RecordsAffected, adCmdText);
|
|
|
+ // 不管结果;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 副门市;
|
|
|
+ if (ren2.vt != VT_NULL && ren2.vt != VT_EMPTY && _tcscmp(ren2.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ if (varEmployeeId2.vt != VT_NULL && varEmployeeId2.vt != VT_EMPTY && _tcscmp(varEmployeeId2.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ strSql.Format(_T("select * from tb_ErpOrdersPerson where OrdPe_Type = '1' and OrdPe_OrderNumber='%s' and OrdPe_OrdersPerson='%s'"), varOrder.bstrVal, varEmployeeId2.bstrVal);
|
|
|
+ _RecordsetPtr result = c2pQueryExspcits(strSql, m_pPlatinumConnection);
|
|
|
+
|
|
|
+ if (result == NULL || result->adoEOF == VARIANT_TRUE)
|
|
|
+ {
|
|
|
+ // 有些订单的员工,可以被删除了;
|
|
|
+ strSql.Format(_T("insert tb_ErpOrdersPerson(OrdPe_OrderNumber,\
|
|
|
+ OrdPe_OrdersPerson,OrdPe_Type,OrdPe_CreateDateTime) \
|
|
|
+ values('%s','%s','1','%s')"),
|
|
|
+ varOrder.bstrVal, varEmployeeId2.bstrVal, time.bstrVal);
|
|
|
+ m_pRecordset = m_pPlatinumConnection->Execute(_bstr_t(strSql), &RecordsAffected, adCmdText);
|
|
|
+ // 不管结果;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pOrderDigital(_variant_t & varOrder, _RecordsetPtr pcRecordSet)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ HRESULT hr = S_OK;
|
|
|
+ _RecordsetPtr rs;
|
|
|
+ rs.CreateInstance(__uuidof(Recordset));
|
|
|
+ hr = rs->Open(_T("select * from tb_ErpOrderDigital"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ rs->AddNew();
|
|
|
+ rs->PutCollect(_T("Ordv_Number"), varOrder);
|
|
|
+ rs->PutCollect(_T("Ordv_ViceNumber"), [&, this]()->_variant_t {
|
|
|
+ TCHAR szViceNumber[50] = { 0 };
|
|
|
+ _stprintf_s(szViceNumber, _T("%s_001"), varOrder.bstrVal);
|
|
|
+ return szViceNumber;
|
|
|
+ }());
|
|
|
+ rs->PutCollect(_T("Ordv_DigitalNumber"), 1);
|
|
|
+ // 服装套数;
|
|
|
+ rs->PutCollect(_T("Ordv_ClothingStatus"), [&, this]()->_variant_t {
|
|
|
+ _variant_t var = pcRecordSet->GetCollect(_T("clothescount"));
|
|
|
+
|
|
|
+ if (var.vt == VT_NULL || _tcscmp(var.bstrVal, _T("")) == 0)
|
|
|
+ {
|
|
|
+ var.vt = VT_I4;
|
|
|
+ var.intVal = 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var.vt = VT_I4;
|
|
|
+ var.intVal = 1;
|
|
|
+ }
|
|
|
+ return var;
|
|
|
+ }());
|
|
|
+ // 初修师;
|
|
|
+ rs->PutCollect(_T("Ordv_EarlyRepairName"), c2pGetEmployeeId(pcRecordSet->GetCollect(_T("waiter5"))));
|
|
|
+ //rs->PutCollect(_T("Ordv_EarlyRepairTime"), VARDATENULL(pcRecordSet->GetCollect(_T("time8"))));
|
|
|
+ DATENULL(rs, _T("Ordv_EarlyRepairTime"), pcRecordSet->GetCollect(_T("time8")));
|
|
|
+ rs->PutCollect(_T("Ordv_EarlyRepairStatus"), [&, this]()->_variant_t {
|
|
|
+ _variant_t var = pcRecordSet->GetCollect(_T("status4"));
|
|
|
+
|
|
|
+ if (var.vt == VT_NULL || _tcscmp(var.bstrVal, _T("")) == 0 || _tcscmp(var.bstrVal, _T("未修")) == 0)
|
|
|
+ return 0;
|
|
|
+ else if (_tcscmp(var.bstrVal, _T("修片中")) == 0)
|
|
|
+ return 1;
|
|
|
+ else
|
|
|
+ return 2;
|
|
|
+ }());
|
|
|
+ // 选片;
|
|
|
+ rs->PutCollect(_T("Ordv_FilmSelectionName"), c2pGetEmployeeId(pcRecordSet->GetCollect(_T("waiter3"))));
|
|
|
+ //rs->PutCollect(_T("Ordv_FilmSelectionTime"), VARDATENULL(pcRecordSet->GetCollect(_T("time4"))));
|
|
|
+ DATENULL2(rs, _T("Ordv_FilmSelectionTime"), pcRecordSet->GetCollect(_T("time4")));
|
|
|
+ rs->PutCollect(_T("Ordv_FilmSelectionStatus"), [&, this]()->_variant_t {
|
|
|
+ _variant_t var = pcRecordSet->GetCollect(_T("status2"));
|
|
|
+
|
|
|
+ if (var.vt == VT_NULL || _tcscmp(var.bstrVal, _T("")) == 0 || _tcscmp(var.bstrVal, _T("未选")) == 0)
|
|
|
+ {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ { // if (_tcscmp(var.bstrVal, _T("OK")) == 0)
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ }());
|
|
|
+ // 设计;
|
|
|
+ rs->PutCollect(_T("Ordv_DesignerName"), c2pGetEmployeeId(pcRecordSet->GetCollect(_T("waiter4"))));
|
|
|
+ //rs->PutCollect(_T("Ordv_DesignerTime"), VARDATENULL(pcRecordSet->GetCollect(_T("time10"))));
|
|
|
+ DATENULL(rs, _T("Ordv_DesignerTime"), pcRecordSet->GetCollect(_T("time10")));
|
|
|
+ rs->PutCollect(_T("Ordv_DesignerStatus"), [&, this]()->_variant_t {
|
|
|
+ _variant_t var = pcRecordSet->GetCollect(_T("status5"));
|
|
|
+
|
|
|
+ if (var.vt == VT_NULL || _tcscmp(var.bstrVal, _T("")) == 0 || _tcscmp(var.bstrVal, _T("未设计")) == 0)
|
|
|
+ {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ else if (_tcscmp(var.bstrVal, _T("设计中")) == 0)
|
|
|
+ {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ { // if (_tcscmp(var.bstrVal, _T("OK")) == 0)
|
|
|
+ return 2;
|
|
|
+ }
|
|
|
+ }());
|
|
|
+ // 精修师;
|
|
|
+ rs->PutCollect(_T("Ordv_RefinementName"), c2pGetEmployeeId(pcRecordSet->GetCollect(_T("waiter7"))));
|
|
|
+ //rs->PutCollect(_T("Ordv_RefinementTime"), VARDATENULL(pcRecordSet->GetCollect(_T("time9"))));
|
|
|
+ DATENULL(rs, _T("Ordv_RefinementTime"), pcRecordSet->GetCollect(_T("time9")));
|
|
|
+ rs->PutCollect(_T("Ordv_RefinementStatus"), [&, this]()->_variant_t {
|
|
|
+ _variant_t var = pcRecordSet->GetCollect(_T("status6"));
|
|
|
+
|
|
|
+ if (var.vt == VT_NULL || _tcscmp(var.bstrVal, _T("")) == 0 || _tcscmp(var.bstrVal, _T("未修")) == 0)
|
|
|
+ {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ else if (_tcscmp(var.bstrVal, _T("修片中")) == 0)
|
|
|
+ {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ { // if (_tcscmp(var.bstrVal, _T("OK")) == 0)
|
|
|
+ return 2;
|
|
|
+ }
|
|
|
+ }());
|
|
|
+ // 看设计;
|
|
|
+ rs->PutCollect(_T("Ordv_LookDesignName"), c2pGetEmployeeId(pcRecordSet->GetCollect(_T("waiter8"))));
|
|
|
+ //rs->PutCollect(_T("Ordv_LookDesignTime"), VARDATENULL(pcRecordSet->GetCollect(_T("time6"))));
|
|
|
+ DATENULL2(rs, _T("Ordv_LookDesignTime"), pcRecordSet->GetCollect(_T("time6")));
|
|
|
+ // 长度200;
|
|
|
+ rs->PutCollect(_T("Ordv_LookDesignClaim"), pcRecordSet->GetCollect(_T("bz2")));
|
|
|
+ rs->PutCollect(_T("Ordv_LookDesignStatus"), [&, this]()->_variant_t {
|
|
|
+ _variant_t var = pcRecordSet->GetCollect(_T("status8"));
|
|
|
+
|
|
|
+ if (var.vt == VT_NULL || _tcscmp(var.bstrVal, _T("")) == 0 || _tcscmp(var.bstrVal, _T("未看")) == 0)
|
|
|
+ {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ else if (_tcscmp(var.bstrVal, _T("修改中")) == 0)
|
|
|
+ {
|
|
|
+ return 3;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ { //if (_tcscmp(var.bstrVal, _T("OK")) == 0)
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ }());
|
|
|
+ // 入底加挑张数;choosezs;(不做入册加挑)
|
|
|
+ rs->PutCollect(_T("Ordv_IntoBottomAddPickQuantity"), [&, this]()->_variant_t {
|
|
|
+ _variant_t var = pcRecordSet->GetCollect(_T("choosezs"));
|
|
|
+
|
|
|
+ if (var.vt == VT_NULL || _tcscmp(var.bstrVal, _T("")) == 0)
|
|
|
+ {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ return _ttoi(var.bstrVal);
|
|
|
+ }());
|
|
|
+ // 入底\入册;
|
|
|
+ [&, this]() {
|
|
|
+ CString str = pcRecordSet->GetCollect(_T("taoxizs")).bstrVal;
|
|
|
+ int nAlbum = -1; // 入册数量,默认-1表示全送;
|
|
|
+ int nNegative = -1;// 入底数量,默认-1表示全送;
|
|
|
+ int nIndex = str.Find(_T("\\"));
|
|
|
+
|
|
|
+ if (nIndex == -1)
|
|
|
+ return;
|
|
|
+
|
|
|
+ // 入底;
|
|
|
+ bool bDigit = true;
|
|
|
+
|
|
|
+ // 使用isdigit会出错,宽字符下;
|
|
|
+ if (!str.Left(nIndex).SpanIncluding(_T("0123456789")))
|
|
|
+ {
|
|
|
+ bDigit = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (bDigit)
|
|
|
+ nNegative = _ttoi(str.Left(nIndex));
|
|
|
+
|
|
|
+ rs->PutCollect(_T("Ordv_IntoBottomQuantity"), nNegative);
|
|
|
+
|
|
|
+ // 入册;
|
|
|
+ bDigit = true;
|
|
|
+
|
|
|
+ // 使用isdigit会出错,宽字符下;
|
|
|
+ if (!str.Mid(nIndex + 1).SpanIncluding(_T("0123456789")))
|
|
|
+ {
|
|
|
+ bDigit = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (bDigit)
|
|
|
+ nAlbum = _ttoi(str.Mid(nIndex + 1));
|
|
|
+
|
|
|
+ rs->PutCollect(_T("Ordv_IntoRegisterQuantity"), nAlbum);
|
|
|
+
|
|
|
+ }();
|
|
|
+
|
|
|
+ // 数码礼包入底张数;必填为0,否则导入相片时,看不到员工信息;
|
|
|
+ rs->PutCollect(_T("Ordv_IntoBottomQuantityPackage"), 0);
|
|
|
+
|
|
|
+ // 预约选片人员和选片时间;
|
|
|
+ rs->PutCollect(_T("Ordv_ReservationFilmSelectionDividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ rs->PutCollect(_T("Ordv_ReservationFilmSelectionName"), c2pGetEmployeeId(pcRecordSet->GetCollect(_T("waiter3"))));
|
|
|
+ rs->PutCollect(_T("Ordv_ReservationFilmSelectionTime"), [&, this]()->_variant_t {
|
|
|
+ _variant_t result;
|
|
|
+ _variant_t date = pcRecordSet->GetCollect(_T("time4"));
|
|
|
+ _variant_t time = pcRecordSet->GetCollect(_T("datetime4"));
|
|
|
+
|
|
|
+ if (date.vt != VT_EMPTY && date.vt != VT_NULL && _tcscmp(date.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ CString strdate;
|
|
|
+
|
|
|
+ if (time.vt != VT_EMPTY && time.vt != VT_NULL)
|
|
|
+ {
|
|
|
+ strdate.Format(_T("%s %s"), date.bstrVal, time.bstrVal);
|
|
|
+
|
|
|
+ // time可能包含中文字符;
|
|
|
+ if (strdate.SpanIncluding(_T("0123456789:- ")).IsEmpty())
|
|
|
+ strdate.Format(_T("%s"), date.bstrVal);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ strdate.Format(_T("%s"), date.bstrVal);
|
|
|
+ }
|
|
|
+
|
|
|
+ DATE dt = String2Date(strdate);
|
|
|
+
|
|
|
+ if (dt > 0) //1899年;
|
|
|
+ result = dt;
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }());
|
|
|
+
|
|
|
+ // 预约看样人员和看样时间;
|
|
|
+ rs->PutCollect(_T("Ordv_ReservationLookDesignDividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ rs->PutCollect(_T("Ordv_ReservationLookDesignName"), c2pGetEmployeeId(pcRecordSet->GetCollect(_T("waiter8"))));
|
|
|
+ rs->PutCollect(_T("Ordv_ReservationLookDesignTime"), [&, this]()->_variant_t {
|
|
|
+ _variant_t result;
|
|
|
+ _variant_t date = pcRecordSet->GetCollect(_T("time6"));
|
|
|
+ _variant_t time = pcRecordSet->GetCollect(_T("datetime6"));
|
|
|
+
|
|
|
+ if (date.vt != VT_EMPTY && date.vt != VT_NULL && _tcscmp(date.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ CString strdate;
|
|
|
+
|
|
|
+ if (time.vt != VT_EMPTY && time.vt != VT_NULL)
|
|
|
+ {
|
|
|
+ strdate.Format(_T("%s %s"), date.bstrVal, time.bstrVal);
|
|
|
+
|
|
|
+ // time可能包含中文字符;
|
|
|
+ if (strdate.SpanIncluding(_T("0123456789:- ")).IsEmpty())
|
|
|
+ strdate.Format(_T("%s"), date.bstrVal);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ strdate.Format(_T("%s"), date.bstrVal);
|
|
|
+ }
|
|
|
+
|
|
|
+ DATE dt = String2Date(strdate);
|
|
|
+
|
|
|
+ if (dt > 0) //1899年;
|
|
|
+ result = dt;
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }());
|
|
|
+
|
|
|
+ rs->Update();
|
|
|
+ rs->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d,订单号:%s =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, varOrder.bstrVal, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pOrderDigitalStatus(_variant_t & varOrder, _RecordsetPtr pcRecordSet)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ HRESULT hr = S_OK;
|
|
|
+ _RecordsetPtr rs;
|
|
|
+ rs.CreateInstance(__uuidof(Recordset));
|
|
|
+ hr = rs->Open(_T("select * from tb_ErpOrderDigitalStatus"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ rs->AddNew();
|
|
|
+ rs->PutCollect(_T("Ords_Number"), [&, this]()->_variant_t {
|
|
|
+ // 如果存在, 或者异常,新建spid;
|
|
|
+ TCHAR szUid[50] = { 0 };
|
|
|
+ TCHAR szResult[50] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 50, 10);
|
|
|
+ _stprintf_s(szResult, _T("ORDS_%s"), &szUid);
|
|
|
+ return szResult;
|
|
|
+ }());
|
|
|
+ rs->PutCollect(_T("Ords_OrdNumber"), varOrder);
|
|
|
+ rs->PutCollect(_T("Ords_ViceNumber"), [&, this]()->_variant_t {
|
|
|
+ TCHAR szViceNumber[50] = { 0 };
|
|
|
+ _stprintf_s(szViceNumber, _T("%s_001"), varOrder.bstrVal);
|
|
|
+ return szViceNumber;
|
|
|
+ }());
|
|
|
+ rs->PutCollect(_T("Ords_DigitalNumber"), 1);
|
|
|
+ rs->PutCollect(_T("Ords_OutSendEarlyRepairStatus"), _T("未发"));//外发初修;
|
|
|
+ rs->PutCollect(_T("Ords_OutSendEarlyRepairQuantity"), 0);
|
|
|
+ //数码拍照状态;
|
|
|
+ rs->PutCollect(_T("Ords_PhotographStatus"), pcRecordSet->GetCollect(_T("status")));//_T("未拍"));
|
|
|
+ rs->PutCollect(_T("Ords_PhotographIntStatus"), [&, this]()->_variant_t {
|
|
|
+ _variant_t var = pcRecordSet->GetCollect(_T("status"));
|
|
|
+
|
|
|
+ if (var.vt == VT_NULL || _tcscmp(var.bstrVal, _T("")) == 0 || _tcscmp(var.bstrVal, _T("未拍")) == 0)
|
|
|
+ return 0;
|
|
|
+ else if (_tcscmp(var.bstrVal, _T("OK")) == 0)
|
|
|
+ return 2;
|
|
|
+ else
|
|
|
+ return 1;
|
|
|
+ }());
|
|
|
+ rs->PutCollect(_T("Ords_ProductCount"), 0);
|
|
|
+ rs->PutCollect(_T("Ords_ProductSendStatus"), _T("未发"));
|
|
|
+ rs->PutCollect(_T("Ords_ProductCompletedStatus"), _T("未完"));
|
|
|
+ rs->PutCollect(_T("Ords_ProductPickupStatus"), _T("未取"));
|
|
|
+ rs->PutCollect(_T("Ords_ProductPickupIntStatus"), 0);
|
|
|
+ rs->PutCollect(_T("Ords_ProductIsExpedited"), _T("否"));//是否加急;
|
|
|
+ rs->PutCollect(_T("Ords_ServiceCount"), 0);//数码服务数量
|
|
|
+ rs->PutCollect(_T("Ords_ServiceStatus"), _T("未进行"));//数码服务状态 未进行、已完(OK)、进行中
|
|
|
+ rs->PutCollect(_T("Ords_ServiceIntStatus"), 0);//数码服务状态 0:未进行、1:进行中、2:OK
|
|
|
+ rs->PutCollect(_T("Ords_OutSendRefineRepairStatus"), _T("未发"));//外发精修状态 未发、已发、已回
|
|
|
+ rs->PutCollect(_T("Ords_OutSendRefineRepairQuantity"), 0);//外发精修数量
|
|
|
+
|
|
|
+ rs->Update();
|
|
|
+ rs->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 根据id查询dindanjd表,再转换插入tb_ErpOrdersPhotography;
|
|
|
+void c2p::c2pOrderScenicSpot(_variant_t &varClassicOrder, _variant_t &varPlatinumOrder, _RecordsetPtr pcRecordSet)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+#ifdef _DEBUG
|
|
|
+
|
|
|
+ if (_tcscmp(varClassicOrder.bstrVal, _T("20120324-001")) == 0)
|
|
|
+ {
|
|
|
+ WriteTextLog(_T("c2pOrderScenicSpot"));
|
|
|
+ }
|
|
|
+
|
|
|
+#endif
|
|
|
+ CString strSql;
|
|
|
+ _RecordsetPtr rsdindanjd;
|
|
|
+ rsdindanjd.CreateInstance(__uuidof(Recordset));
|
|
|
+ strSql.Format(_T("select * from dindanjd where id = '%s'"), varClassicOrder.bstrVal);
|
|
|
+ HRESULT hr = rsdindanjd->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockReadOnly, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ _RecordsetPtr rsScenicSpot;
|
|
|
+ rsScenicSpot.CreateInstance(__uuidof(Recordset));
|
|
|
+ hr = rsScenicSpot->Open(_T("select * from tb_ErpOrdersPhotography"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ while (rsdindanjd->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ rsScenicSpot->AddNew();
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_IDNumber"), [&, this]()->_variant_t {
|
|
|
+ TCHAR szID[50] = { 0 };
|
|
|
+ TCHAR szResult[50] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szID, 50, 10);
|
|
|
+ _stprintf_s(szResult, _T("ORDS_%s"), &szID);
|
|
|
+ return szResult;
|
|
|
+ }());
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_Number"), varPlatinumOrder);
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_ViceNumber"), [&, this]()->_variant_t {
|
|
|
+ TCHAR szViceNumber[50] = { 0 };
|
|
|
+ _stprintf_s(szViceNumber, _T("%s_001"), varPlatinumOrder.bstrVal);
|
|
|
+ return szViceNumber;
|
|
|
+ }());
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_Sights"), rsdindanjd->GetCollect(_T("name")));
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_CostPrice"), 0);
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_SightsLevel"), _T("BEBBBCADDEBFJDFFC"));//景点等级,都是一级;
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_SightsType"), _T("0"));//景点类别 (0:内景 , 1:外景)//经典无此分类;
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_ApparelQuantity"), 0);//服装套数//经典无此分类;
|
|
|
+ // 摄影师;
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_Photographer"), c2pGetEmployeeId(pcRecordSet->GetCollect(_T("waiter1"))));
|
|
|
+ //拍摄时间;
|
|
|
+ DATENULL(rsScenicSpot, _T("Ordpg_PhotographyTime"), rsdindanjd->GetCollect(_T("date")));
|
|
|
+ //拍摄状态 0:未拍 1: OK(已拍) 2:拍照中
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_PhotographyStatus"), [&, this]()->_variant_t {
|
|
|
+ _variant_t var = rsdindanjd->GetCollect(_T("status"));
|
|
|
+
|
|
|
+ if (var.vt == VT_NULL || _tcscmp(var.bstrVal, _T("")) == 0 || _tcscmp(var.bstrVal, _T("未拍")) == 0)
|
|
|
+ return _T("0");
|
|
|
+ else if (_tcscmp(var.bstrVal, _T("OK")) == 0)
|
|
|
+ return _T("1");
|
|
|
+ else
|
|
|
+ return _T("2");
|
|
|
+ }());
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_PhotographyAssistant"), c2pGetEmployeeId(pcRecordSet->GetCollect(_T("waiter12"))));//摄影助理;
|
|
|
+
|
|
|
+ if (Global::g_bChildVersion)
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_BootDivision"), c2pGetEmployeeId(pcRecordSet->GetCollect(_T("waiter2"))));//引导师;
|
|
|
+ else
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_MakeupArtist"), c2pGetEmployeeId(pcRecordSet->GetCollect(_T("waiter2"))));//化妆师;
|
|
|
+
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_MakeupAssistant"), c2pGetEmployeeId(pcRecordSet->GetCollect(_T("waiter22"))));//化妆师助理;
|
|
|
+ // 预约拍照日期与时间;
|
|
|
+ //DATENULL(rsScenicSpot, _T("Ordpg_ReservationPhotographyTime"), rsdindanjd->GetCollect(_T("bookingdate")));
|
|
|
+ //rsScenicSpot->PutCollect(_T("Ordpg_Remark"), rsdindanjd->GetCollect(_T("time")));
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_ReservationPhotographyTime"), [&, this]()->_variant_t {
|
|
|
+ _variant_t result;
|
|
|
+ _variant_t date = rsdindanjd->GetCollect(_T("bookingdate"));
|
|
|
+ _variant_t time = rsdindanjd->GetCollect(_T("time"));
|
|
|
+
|
|
|
+ if (date.vt != VT_EMPTY && date.vt != VT_NULL && _tcscmp(date.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ CString strdate;
|
|
|
+
|
|
|
+ if (time.vt != VT_EMPTY && time.vt != VT_NULL)
|
|
|
+ {
|
|
|
+ strdate.Format(_T("%s %s"), date.bstrVal, time.bstrVal);
|
|
|
+
|
|
|
+ // time可能包含中文字符;
|
|
|
+ if (strdate.SpanIncluding(_T("0123456789:- ")).IsEmpty())
|
|
|
+ strdate.Format(_T("%s"), date.bstrVal);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ strdate.Format(_T("%s"), date.bstrVal);
|
|
|
+ }
|
|
|
+
|
|
|
+ DATE dt = String2Date(strdate);
|
|
|
+
|
|
|
+ if (dt > 0) //1899年;
|
|
|
+ result = dt;
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }());
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_ReservationPhotographyDividedShop"), Global::g_szPlatinumBranchId);//预约分店;
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_ReservationPhotographyName"), c2pGetEmployeeId(rsdindanjd->GetCollect(_T("waiter1"))));//预约摄影师;
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_ReservationPhotographyAssistant"), c2pGetEmployeeId(rsdindanjd->GetCollect(_T("waiter12"))));//预约摄影师助理;
|
|
|
+
|
|
|
+ if (Global::g_bChildVersion)
|
|
|
+ {
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_ReservationBootDivision"), c2pGetEmployeeId(rsdindanjd->GetCollect(_T("waiter2"))));//预约引导师;
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_ReservationBootDivisionAssistant"), c2pGetEmployeeId(rsdindanjd->GetCollect(_T("waiter22"))));//预约引导师助理;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_ReservationMakeupArtist"), c2pGetEmployeeId(rsdindanjd->GetCollect(_T("waiter2"))));//预约化妆师;
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_ReservationMakeupAssistant"), c2pGetEmployeeId(rsdindanjd->GetCollect(_T("waiter22"))));//预约化妆师助理;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_Remark"), rsdindanjd->GetCollect(_T("bz")));
|
|
|
+ // 售价;
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_SalesPrice"), 0);
|
|
|
+ DATENULL(rsScenicSpot, _T("Ordpg_CreateDateTime"), pcRecordSet->GetCollect(_T("time1")));
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ rsScenicSpot->Update();
|
|
|
+ rsdindanjd->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsScenicSpot->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsdindanjd->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d,%s =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, varClassicOrder.bstrVal, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pOrderCustomerGroup(_variant_t & varClassicOrder, _variant_t & varPlatinumOrder, _RecordsetPtr pcRecordSet)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ CString strSql;
|
|
|
+ _RecordsetPtr rsCustomerGroup;
|
|
|
+ rsCustomerGroup.CreateInstance(__uuidof(Recordset));
|
|
|
+ strSql.Format(_T("select * from tb_ErpCustomerGroup where GP_OrderNumber = '%s'"), varPlatinumOrder.bstrVal);
|
|
|
+ HRESULT hr = rsCustomerGroup->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ if (rsCustomerGroup->adoEOF == VARIANT_TRUE)
|
|
|
+ {
|
|
|
+ _variant_t var;
|
|
|
+#ifdef _DEBUG
|
|
|
+
|
|
|
+ if (_tcscmp(varClassicOrder.bstrVal, _T("20110526-002")) == 0)
|
|
|
+ {
|
|
|
+ WriteTextLog(_T("c2pOrderCustomerGroup"));
|
|
|
+ }
|
|
|
+
|
|
|
+#endif
|
|
|
+ rsCustomerGroup->AddNew();
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ //rsCustomerGroup->PutCollect(_T("c2p_order"), varClassicOrder.bstrVal);
|
|
|
+ rsCustomerGroup->PutCollect(_T("GP_DividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ rsCustomerGroup->PutCollect(_T("GP_OrderNumber"), varPlatinumOrder);
|
|
|
+ rsCustomerGroup->PutCollect(_T("GP_CustomerGroupID"), [&, this]()->_variant_t {
|
|
|
+ TCHAR szUID[24] = { 0 };
|
|
|
+ TCHAR szResult[50] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUID, 24, 10);
|
|
|
+ _stprintf_s(szResult, _T("GP_%s"), szUID);
|
|
|
+ return szResult;
|
|
|
+ }());
|
|
|
+ // 客户组类型 0 为其它客户/订单客户 1 为老客户 2 为意向客户
|
|
|
+ rsCustomerGroup->PutCollect(_T("GP_GroupType"), 0);
|
|
|
+ // 客户类型 - 1:为其它订单客户 0 : 为婚纱订单客户 1 : 为儿童订单客户 2 : 写真订单客户 3 : 为服务订单客户 4 : 婚庆订单客户
|
|
|
+ rsCustomerGroup->PutCollect(_T("GP_CustomerType"), Global::g_bChildVersion);
|
|
|
+ // 客户状态 正常 意向 流失 追回
|
|
|
+ rsCustomerGroup->PutCollect(_T("GP_CustomerStatus"), _T("正常"));
|
|
|
+ var = pcRecordSet->GetCollect(_T("from"));
|
|
|
+
|
|
|
+ if (var.vt == VT_EMPTY || var.vt == VT_NULL || _tcscmp(var.bstrVal, _T("")) == 0)
|
|
|
+ rsCustomerGroup->PutCollect(_T("GP_CustomerSource"), _T(""));
|
|
|
+ else
|
|
|
+ rsCustomerGroup->PutCollect(_T("GP_CustomerSource"), pcRecordSet->GetCollect(_T("from")));
|
|
|
+
|
|
|
+ DATENULL(rsCustomerGroup, _T("GP_CreateDatetime"), pcRecordSet->GetCollect(_T("time1")));
|
|
|
+ // 非空字段;
|
|
|
+ rsCustomerGroup->PutCollect(_T("GP_LossReason"), _T(""));
|
|
|
+ rsCustomerGroup->PutCollect(_T("GP_DegreeOfIntent"), _T(""));
|
|
|
+ // 0为非意客户,1为录入意向客户,2为订单意向客户
|
|
|
+ rsCustomerGroup->PutCollect(_T("GP_ISIntentionCustomer"), 2);
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ rsCustomerGroup->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsCustomerGroup->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d,%s =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, varClassicOrder.bstrVal, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 经典顾客,可重复存在一表,以电话号码判断是否重复;
|
|
|
+void c2p::c2pCustomers(_variant_t & varClassicOrder, _RecordsetPtr pcRecordSet)
|
|
|
+{
|
|
|
+#ifdef _DEBUG
|
|
|
+
|
|
|
+ if (_tcscmp(varClassicOrder.bstrVal, _T("20161108-003")) == 0)
|
|
|
+ {
|
|
|
+ WriteTextLog(_T("c2pCustomers"));
|
|
|
+ }
|
|
|
+
|
|
|
+#endif
|
|
|
+
|
|
|
+ try
|
|
|
+ {
|
|
|
+ CString strSql;
|
|
|
+ _RecordsetPtr rsClient;
|
|
|
+ _RecordsetPtr rsCustomer;
|
|
|
+ // 创建实例;
|
|
|
+ rsClient.CreateInstance(__uuidof(Recordset));
|
|
|
+ rsCustomer.CreateInstance(__uuidof(Recordset));
|
|
|
+ // 打开实例;
|
|
|
+ strSql.Format(_T("select * from tb_ErpCustomer"), varClassicOrder.bstrVal);
|
|
|
+ HRESULT hr = rsCustomer->Open(_T("select * from tb_ErpCustomer"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ // 打开实例;
|
|
|
+ strSql.Format(_T("select * from client where id = '%s'"), varClassicOrder.bstrVal);
|
|
|
+ hr = rsClient->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ _variant_t varGroupId = c2pGetGroupId(varClassicOrder);
|
|
|
+
|
|
|
+ if (rsClient->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ _variant_t varCustomerId;
|
|
|
+ _variant_t varCustomerId2;
|
|
|
+ _variant_t name1 = rsClient->GetCollect(_T("name1"));
|
|
|
+ _variant_t name2 = rsClient->GetCollect(_T("name2"));
|
|
|
+
|
|
|
+ // 如果是儿童版本;
|
|
|
+ if (Global::g_bChildVersion)
|
|
|
+ {
|
|
|
+ // 先判断成人电话是否存在,如果没有电话号码,则不录入(铂金成人必需要有电话);
|
|
|
+ _variant_t varTelPhone1 = rsClient->GetCollect(_T("phone1"));
|
|
|
+
|
|
|
+ // 没有电话号码的, 不录入;
|
|
|
+ if (varTelPhone1.vt != VT_NULL && varTelPhone1.vt != VT_EMPTY && _tcscmp(varTelPhone1.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ // 到tb_ErpCustomer中查找成人;
|
|
|
+ bool bExsits = false;
|
|
|
+ _variant_t varCusTelephone;
|
|
|
+
|
|
|
+ while (rsCustomer->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ varCusTelephone = rsCustomer->GetCollect(_T("Cus_Telephone"));
|
|
|
+
|
|
|
+ if (varCusTelephone.vt != VT_NULL && varCusTelephone.vt != VT_EMPTY && _tcscmp(varCusTelephone.bstrVal, varTelPhone1.bstrVal) == 0)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsCustomer->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ // 成人;
|
|
|
+ if (bExsits)
|
|
|
+ {
|
|
|
+ // 直接插入tb_ErpCustomerGroupMember;
|
|
|
+ varCustomerId = rsCustomer->GetCollect(_T("Cus_CustomerNumber"));
|
|
|
+ rsCustomer->MoveFirst();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //rsCustomer->MoveFirst();
|
|
|
+ rsCustomer->AddNew();
|
|
|
+ rsCustomer->PutCollect(_T("Cus_DividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ rsCustomer->PutCollect(_T("Cus_CustomerNumber"), varCustomerId = [&, this]()->_variant_t {
|
|
|
+ TCHAR szUID[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUID, 24, 10);
|
|
|
+ return szUID;
|
|
|
+ }());
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Type"), _T(""));// 成人空;
|
|
|
+
|
|
|
+ // 如果家长姓名空,使用儿童姓名;
|
|
|
+ if (name1.vt == VT_NULL || name1.vt == VT_EMPTY || _tcscmp(name1.bstrVal, _T("")) == 0)
|
|
|
+ {
|
|
|
+ //rsCustomer->PutCollect(_T("Cus_Name"), name2);
|
|
|
+ //rsCustomer->PutCollect(_T("Cus_NamePinyin"), pcRecordSet->GetCollect(_T("pinyin2")));
|
|
|
+ CusName(rsCustomer, _T("Cus_Name"), name2);
|
|
|
+ CusName(rsCustomer, _T("Cus_NamePinyin"), pcRecordSet->GetCollect(_T("pinyin2")));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //rsCustomer->PutCollect(_T("Cus_Name"), name1);
|
|
|
+ //rsCustomer->PutCollect(_T("Cus_NamePinyin"), pcRecordSet->GetCollect(_T("pinyin1")));
|
|
|
+ CusName(rsCustomer, _T("Cus_Name"), name1);
|
|
|
+ CusName(rsCustomer, _T("Cus_NamePinyin"), pcRecordSet->GetCollect(_T("pinyin1")));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 生日;
|
|
|
+ //DATENULL(rsCustomer, _T("Cus_Birthday"), rsClient->GetCollect(_T("birthday1")));
|
|
|
+ /*_variant_t varCheck = rsClient->GetCollect(_T("check1"));
|
|
|
+ if (varCheck.vt != VT_EMPTY && varCheck.vt != VT_NULL && _tcscmp(varCheck.bstrVal, _T("0")) == 0)
|
|
|
+ {
|
|
|
+ if (CalendarEx::IsValidSolarDate(rsClient->GetCollect(_T("birthday1")).bstrVal))
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Birthday"), rsClient->GetCollect(_T("birthday1")));
|
|
|
+ rsCustomer->PutCollect(_T("Cus_BirthdayLunar"), varCheck);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (CalendarEx::IsValidLunanrDate(rsClient->GetCollect(_T("birthday1")).bstrVal))
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Birthday"), rsClient->GetCollect(_T("birthday1")));
|
|
|
+ rsCustomer->PutCollect(_T("Cus_BirthdayLunar"), varCheck);
|
|
|
+ }*/
|
|
|
+ // 电话号码长度过长;
|
|
|
+ [&, this]() {
|
|
|
+ CString str = varTelPhone1.bstrVal;
|
|
|
+
|
|
|
+ if (str.GetLength() > 20)
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Telephone"), _variant_t(str.Left(20)));
|
|
|
+ else
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Telephone"), varTelPhone1);
|
|
|
+ }();
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Sex"), _tcscmp(rsClient->GetCollect(_T("sex")).bstrVal, _T("女")) == 0 ? true : false);
|
|
|
+ DATENULL(rsCustomer, _T("Cus_CreateDateTime"), pcRecordSet->GetCollect(_T("time1")));
|
|
|
+ _variant_t qq = rsClient->GetCollect(_T("qq1"));
|
|
|
+ rsCustomer->PutCollect(_T("Cus_QQ"), _variant_t((qq.vt == VT_EMPTY || qq.vt == VT_NULL) ? _T("") : CString(qq.bstrVal).Left(30)));
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Region"), rsClient->GetCollect(_T("area")));
|
|
|
+ rsCustomer->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ // 儿童;//儿童姓名可能空,此时不添加;
|
|
|
+ {
|
|
|
+ if (name2.vt != VT_NULL && name2.vt != VT_EMPTY && _tcscmp(name2.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ // 这个宝宝是否存在;
|
|
|
+ varCustomerId2 = [&, this]()->_variant_t {
|
|
|
+ // 根据家长ID来查找tb_ErpCustomerGroupMembers;
|
|
|
+ CString str;
|
|
|
+ str.Format(_T("SELECT * FROM tb_ErpCustomer WHERE Cus_CustomerNumber IN (")
|
|
|
+ _T("SELECT GM_RelatedPersonID FROM [tb_ErpCustomerGroupMembers] WHERE GM_CustomerID = '%s' ) and Cus_Type = '儿童'"), varCustomerId.bstrVal);
|
|
|
+ _RecordsetPtr rsView;
|
|
|
+ _variant_t ChildId;
|
|
|
+ rsView.CreateInstance(__uuidof(Recordset));
|
|
|
+ hr = rsView->Open(_variant_t(str), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ while (rsView->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (_tcscmp(rsView->GetCollect(_T("Cus_Name")).bstrVal, name2.bstrVal) == 0)
|
|
|
+ {
|
|
|
+ ChildId = rsView->GetCollect(_T("Cus_CustomerNumber"));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsView->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsView->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ return ChildId;
|
|
|
+ }();
|
|
|
+
|
|
|
+ if (varCustomerId2.vt == VT_NULL || varCustomerId2.vt == VT_EMPTY)
|
|
|
+ {
|
|
|
+ // 没有该儿童, 创建一个;
|
|
|
+ rsCustomer->AddNew();
|
|
|
+ rsCustomer->PutCollect(_T("Cus_DividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ rsCustomer->PutCollect(_T("Cus_CustomerNumber"), varCustomerId2 = [&, this]()->_variant_t {
|
|
|
+ TCHAR szUID[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUID, 24, 10);
|
|
|
+ return szUID;
|
|
|
+ }());
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Type"), _T("儿童"));
|
|
|
+ //rsCustomer->PutCollect(_T("Cus_Name"), name2);
|
|
|
+ // 拼音;
|
|
|
+ //rsCustomer->PutCollect(_T("Cus_NamePinyin"), pcRecordSet->GetCollect(_T("pinyin2")));
|
|
|
+ CusName(rsCustomer, _T("Cus_Name"), name2);
|
|
|
+ CusName(rsCustomer, _T("Cus_NamePinyin"), pcRecordSet->GetCollect(_T("pinyin2")));
|
|
|
+ // 生日;
|
|
|
+ //DATENULL(rsCustomer, _T("Cus_Birthday"), rsClient->GetCollect(_T("birthday2")));
|
|
|
+ //rsCustomer->PutCollect(_T("Cus_Birthday"), rsClient->GetCollect(_T("birthday2")));
|
|
|
+ //rsCustomer->PutCollect(_T("Cus_BirthdayLunar"), rsClient->GetCollect(_T("check2")));
|
|
|
+ _variant_t varCheck = rsClient->GetCollect(_T("check1"));
|
|
|
+
|
|
|
+ if (varCheck.vt != VT_EMPTY && varCheck.vt != VT_NULL && _tcscmp(varCheck.bstrVal, _T("0")) == 0)
|
|
|
+ {
|
|
|
+ if (CalendarEx::IsValidSolarDate(rsClient->GetCollect(_T("birthday1")).bstrVal))
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Birthday"), rsClient->GetCollect(_T("birthday1")));
|
|
|
+
|
|
|
+ rsCustomer->PutCollect(_T("Cus_BirthdayLunar"), varCheck);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (CalendarEx::IsValidLunanrDate(rsClient->GetCollect(_T("birthday1")).bstrVal))
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Birthday"), rsClient->GetCollect(_T("birthday1")));
|
|
|
+
|
|
|
+ rsCustomer->PutCollect(_T("Cus_BirthdayLunar"), varCheck);
|
|
|
+ }
|
|
|
+
|
|
|
+ //rsCustomer->PutCollect(_T("Cus_Telephone"), varTelPhone1);
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Zodiac"), rsClient->GetCollect(_T("zodiac")));
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Sex"), _tcscmp(rsClient->GetCollect(_T("sex")).bstrVal, _T("女")) == 0 ? true : false);
|
|
|
+ DATENULL(rsCustomer, _T("Cus_CreateDateTime"), pcRecordSet->GetCollect(_T("time1")));
|
|
|
+ //rsCustomer->PutCollect(_T("Cus_QQ"), rsClient->GetCollect(_T("qq1")));
|
|
|
+ // Cus_DayForMarriage 婚期;Cus_QQ
|
|
|
+ rsCustomer->Update();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ // 插入到Group中;
|
|
|
+ [&, this]() {
|
|
|
+ _RecordsetPtr rsGroupMember;
|
|
|
+ rsGroupMember.CreateInstance(__uuidof(Recordset));
|
|
|
+ hr = rsGroupMember->Open(_T("select * from tb_ErpCustomerGroupMembers"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ if (varCustomerId.vt != VT_NULL && varCustomerId.vt != VT_EMPTY)
|
|
|
+ {
|
|
|
+ // 成人;
|
|
|
+ rsGroupMember->AddNew();
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ rsGroupMember->PutCollect(_T("GM_DividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ rsGroupMember->PutCollect(_T("GM_CustomerGroupID"), varGroupId);
|
|
|
+ rsGroupMember->PutCollect(_T("GM_CustomerID"), varCustomerId);
|
|
|
+ rsGroupMember->PutCollect(_T("GM_Master"), 1);// 主联系人;
|
|
|
+ rsGroupMember->PutCollect(_T("GM_ProtagonistCustomer"), 0);//拍照对象;
|
|
|
+
|
|
|
+ if (varCustomerId2.vt != VT_EMPTY && varCustomerId2.vt != VT_NULL)
|
|
|
+ {
|
|
|
+ // 宝宝id;
|
|
|
+ rsGroupMember->PutCollect(_T("GM_RelatedPersonID"), varCustomerId2);
|
|
|
+ rsGroupMember->PutCollect(_T("GM_Relation"), _T("家长"));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ rsGroupMember->PutCollect(_T("GM_RelatedPersonID"), varCustomerId);
|
|
|
+ rsGroupMember->PutCollect(_T("GM_Relation"), _T("本人"));
|
|
|
+ }
|
|
|
+
|
|
|
+ rsGroupMember->PutCollect(_T("GM_IsOrder"), 1);
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ rsGroupMember->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (varCustomerId2.vt != VT_NULL && varCustomerId2.vt != VT_EMPTY)
|
|
|
+ {
|
|
|
+ // 儿童;
|
|
|
+ rsGroupMember->AddNew();
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ rsGroupMember->PutCollect(_T("GM_DividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ rsGroupMember->PutCollect(_T("GM_CustomerGroupID"), varGroupId);
|
|
|
+ rsGroupMember->PutCollect(_T("GM_CustomerID"), varCustomerId2);
|
|
|
+ rsGroupMember->PutCollect(_T("GM_Master"), 0);// 主联系人;
|
|
|
+ rsGroupMember->PutCollect(_T("GM_ProtagonistCustomer"), 1);//拍照对象;
|
|
|
+ // 本人ID;
|
|
|
+ rsGroupMember->PutCollect(_T("GM_RelatedPersonID"), varCustomerId2);
|
|
|
+ rsGroupMember->PutCollect(_T("GM_Relation"), _T("本人"));//家长没有性别,无法判断是父还是母;
|
|
|
+ rsGroupMember->PutCollect(_T("GM_IsOrder"), 1);
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ rsGroupMember->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsGroupMember->Close();
|
|
|
+ }
|
|
|
+ }();
|
|
|
+ //rsCustomer->MoveFirst();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _variant_t varTelPhone1 = rsClient->GetCollect(_T("phone1"));
|
|
|
+ _variant_t varTelPhone2 = rsClient->GetCollect(_T("phone2"));
|
|
|
+
|
|
|
+ if (name1.vt != VT_EMPTY && name1.vt != VT_NULL && _tcscmp(name1.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ // 男宾姓名不为空;
|
|
|
+ if (varTelPhone1.vt != VT_EMPTY && varTelPhone1.vt != VT_NULL && _tcscmp(varTelPhone1.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ // 男宾电话不为空;
|
|
|
+ varCustomerId = c2pGetCustomerId(varTelPhone1);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (varCustomerId.vt == VT_EMPTY || varCustomerId.vt == VT_NULL)
|
|
|
+ {
|
|
|
+ // 创建新顾客信息;
|
|
|
+ rsCustomer->AddNew();
|
|
|
+ rsCustomer->PutCollect(_T("Cus_DividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ rsCustomer->PutCollect(_T("Cus_CustomerNumber"), varCustomerId = [&, this]()->_variant_t {
|
|
|
+ TCHAR szUID[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUID, 24, 10);
|
|
|
+ return szUID;
|
|
|
+ }());
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Type"), _T(""));// 成人空;
|
|
|
+ //rsCustomer->PutCollect(_T("Cus_Name"), name1);
|
|
|
+ // 拼音;
|
|
|
+ //rsCustomer->PutCollect(_T("Cus_NamePinyin"), pcRecordSet->GetCollect(_T("pinyin1")));
|
|
|
+ CusName(rsCustomer, _T("Cus_Name"), name1);
|
|
|
+ CusName(rsCustomer, _T("Cus_NamePinyin"), pcRecordSet->GetCollect(_T("pinyin1")));
|
|
|
+ // 生日;
|
|
|
+ //DATENULL(rsCustomer, _T("Cus_Birthday"), rsClient->GetCollect(_T("birthday1")));
|
|
|
+ //rsCustomer->PutCollect(_T("Cus_Birthday"), rsClient->GetCollect(_T("birthday1")));
|
|
|
+ //rsCustomer->PutCollect(_T("Cus_BirthdayLunar"), rsClient->GetCollect(_T("check1")));
|
|
|
+ _variant_t varCheck = rsClient->GetCollect(_T("check1"));
|
|
|
+
|
|
|
+ if (varCheck.vt != VT_EMPTY && varCheck.vt != VT_NULL && _tcscmp(varCheck.bstrVal, _T("0")) == 0)
|
|
|
+ {
|
|
|
+ if (CalendarEx::IsValidSolarDate(rsClient->GetCollect(_T("birthday1")).bstrVal))
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Birthday"), rsClient->GetCollect(_T("birthday1")));
|
|
|
+
|
|
|
+ rsCustomer->PutCollect(_T("Cus_BirthdayLunar"), varCheck);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (CalendarEx::IsValidLunanrDate(rsClient->GetCollect(_T("birthday1")).bstrVal))
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Birthday"), rsClient->GetCollect(_T("birthday1")));
|
|
|
+
|
|
|
+ rsCustomer->PutCollect(_T("Cus_BirthdayLunar"), varCheck);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 电话号码长度过长;
|
|
|
+ [&, this]() {
|
|
|
+ CString str = varTelPhone1.bstrVal;
|
|
|
+
|
|
|
+ if (str.GetLength() > 20)
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Telephone"), _variant_t(str.Left(20)));
|
|
|
+ else
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Telephone"), varTelPhone1);
|
|
|
+ }();
|
|
|
+
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Sex"), false);
|
|
|
+ DATENULL(rsCustomer, _T("Cus_CreateDateTime"), pcRecordSet->GetCollect(_T("time1")));
|
|
|
+ _variant_t qq = rsClient->GetCollect(_T("qq1"));
|
|
|
+ rsCustomer->PutCollect(_T("Cus_QQ"), _variant_t((qq.vt == VT_EMPTY || qq.vt == VT_NULL) ? _T("") : CString(qq.bstrVal).Left(30)));
|
|
|
+ // 婚期;//Cus_DayForMarriageLunar
|
|
|
+ DATENULL(rsCustomer, _T("Cus_DayForMarriage"), rsClient->GetCollect(_T("time3")));
|
|
|
+ rsCustomer->PutCollect(_T("Cus_DayForMarriageLunar"), rsClient->GetCollect(_T("check3")));
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Region"), rsClient->GetCollect(_T("area")));
|
|
|
+ rsCustomer->Update();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (name2.vt != VT_EMPTY && name2.vt != VT_NULL && _tcscmp(name2.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ // 女宾姓名不为空;
|
|
|
+ if (varTelPhone2.vt != VT_NULL && _tcscmp(varTelPhone2.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ // 女宾电话不为空;
|
|
|
+ // 女宾的电话可能与男宾一样, 一样时,不录入女宾;
|
|
|
+ if (_tcscmp(varTelPhone1.bstrVal, varTelPhone2.bstrVal) != 0)
|
|
|
+ varCustomerId2 = c2pGetCustomerId(varTelPhone2);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (varCustomerId2.vt == VT_EMPTY || varCustomerId2.vt == VT_NULL)
|
|
|
+ {
|
|
|
+ // 创建新顾客信息;
|
|
|
+ rsCustomer->AddNew();
|
|
|
+ rsCustomer->PutCollect(_T("Cus_DividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ rsCustomer->PutCollect(_T("Cus_CustomerNumber"), varCustomerId2 = [&, this]()->_variant_t {
|
|
|
+ TCHAR szUID[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUID, 24, 10);
|
|
|
+ return szUID;
|
|
|
+ }());
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Type"), _T(""));// 成人空;
|
|
|
+ //rsCustomer->PutCollect(_T("Cus_Name"), name2);
|
|
|
+ // 拼音;
|
|
|
+ //rsCustomer->PutCollect(_T("Cus_NamePinyin"), pcRecordSet->GetCollect(_T("pinyin2")));
|
|
|
+ CusName(rsCustomer, _T("Cus_Name"), name2);
|
|
|
+ CusName(rsCustomer, _T("Cus_NamePinyin"), pcRecordSet->GetCollect(_T("pinyin2")));
|
|
|
+ // 生日;
|
|
|
+ //DATENULL(rsCustomer, _T("Cus_Birthday"), rsClient->GetCollect(_T("birthday2")));
|
|
|
+ //rsCustomer->PutCollect(_T("Cus_Birthday"), rsClient->GetCollect(_T("birthday2")));
|
|
|
+ //rsCustomer->PutCollect(_T("Cus_BirthdayLunar"), rsClient->GetCollect(_T("check2")));
|
|
|
+ _variant_t varCheck = rsClient->GetCollect(_T("check2"));
|
|
|
+
|
|
|
+ if (varCheck.vt != VT_EMPTY && varCheck.vt != VT_NULL && _tcscmp(varCheck.bstrVal, _T("0")) == 0)
|
|
|
+ {
|
|
|
+ if (CalendarEx::IsValidSolarDate(rsClient->GetCollect(_T("birthday2")).bstrVal))
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Birthday"), rsClient->GetCollect(_T("birthday2")));
|
|
|
+
|
|
|
+ rsCustomer->PutCollect(_T("Cus_BirthdayLunar"), varCheck);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (CalendarEx::IsValidLunanrDate(rsClient->GetCollect(_T("birthday2")).bstrVal))
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Birthday"), rsClient->GetCollect(_T("birthday2")));
|
|
|
+
|
|
|
+ rsCustomer->PutCollect(_T("Cus_BirthdayLunar"), varCheck);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 电话号码长度过长;
|
|
|
+ [&, this]() {
|
|
|
+ CString str = varTelPhone2.bstrVal;
|
|
|
+
|
|
|
+ if (str.GetLength() > 20)
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Telephone"), _variant_t(str.Left(20)));
|
|
|
+ else
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Telephone"), varTelPhone2);
|
|
|
+ }();
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Sex"), true);
|
|
|
+ DATENULL(rsCustomer, _T("Cus_CreateDateTime"), pcRecordSet->GetCollect(_T("time1")));
|
|
|
+ _variant_t qq = rsClient->GetCollect(_T("qq2"));
|
|
|
+ rsCustomer->PutCollect(_T("Cus_QQ"), _variant_t((qq.vt == VT_EMPTY || qq.vt == VT_NULL) ? _T("") : CString(qq.bstrVal).Left(30)));
|
|
|
+ // 婚期;//Cus_DayForMarriageLunar
|
|
|
+ varCheck = rsClient->GetCollect(_T("check3"));
|
|
|
+
|
|
|
+ if (varCheck.vt != VT_EMPTY && varCheck.vt != VT_NULL && _tcscmp(varCheck.bstrVal, _T("0")) == 0)
|
|
|
+ {
|
|
|
+ if (CalendarEx::IsValidSolarDate(rsClient->GetCollect(_T("time3")).bstrVal))
|
|
|
+ rsCustomer->PutCollect(_T("Cus_DayForMarriage"), rsClient->GetCollect(_T("time3")));
|
|
|
+
|
|
|
+ rsCustomer->PutCollect(_T("Cus_DayForMarriageLunar"), varCheck);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (CalendarEx::IsValidLunanrDate(rsClient->GetCollect(_T("time3")).bstrVal))
|
|
|
+ rsCustomer->PutCollect(_T("Cus_DayForMarriage"), rsClient->GetCollect(_T("time3")));
|
|
|
+
|
|
|
+ rsCustomer->PutCollect(_T("Cus_DayForMarriageLunar"), varCheck);
|
|
|
+ }
|
|
|
+
|
|
|
+ //DATENULL(rsCustomer, _T("Cus_DayForMarriage"), rsClient->GetCollect(_T("time3")));
|
|
|
+ //rsCustomer->PutCollect(_T("Cus_DayForMarriageLunar"), rsClient->GetCollect(_T("check3")));
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Region"), rsClient->GetCollect(_T("area2")));
|
|
|
+ rsCustomer->Update();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ // 插入到Group中;
|
|
|
+ [&, this]() {
|
|
|
+ _RecordsetPtr rsGroupMember;
|
|
|
+ rsGroupMember.CreateInstance(__uuidof(Recordset));
|
|
|
+ hr = rsGroupMember->Open(_T("select * from tb_ErpCustomerGroupMembers"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ if (varCustomerId.vt != VT_NULL && varCustomerId.vt != VT_EMPTY)
|
|
|
+ {
|
|
|
+ // 男宾;
|
|
|
+ rsGroupMember->AddNew();
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ rsGroupMember->PutCollect(_T("GM_DividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ rsGroupMember->PutCollect(_T("GM_CustomerGroupID"), varGroupId);
|
|
|
+ rsGroupMember->PutCollect(_T("GM_CustomerID"), varCustomerId);
|
|
|
+ rsGroupMember->PutCollect(_T("GM_Master"), 1);// 主联系人;
|
|
|
+ rsGroupMember->PutCollect(_T("GM_ProtagonistCustomer"), 0);//拍照对象;
|
|
|
+ rsGroupMember->PutCollect(_T("GM_RelatedPersonID"), varCustomerId);
|
|
|
+ rsGroupMember->PutCollect(_T("GM_Relation"), _T("家长"));
|
|
|
+ rsGroupMember->PutCollect(_T("GM_IsOrder"), 1);
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ rsGroupMember->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (varCustomerId2.vt != VT_NULL && varCustomerId2.vt != VT_EMPTY)
|
|
|
+ {
|
|
|
+ // 女宾;
|
|
|
+ rsGroupMember->AddNew();
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ rsGroupMember->PutCollect(_T("GM_DividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ rsGroupMember->PutCollect(_T("GM_CustomerGroupID"), varGroupId);
|
|
|
+ rsGroupMember->PutCollect(_T("GM_CustomerID"), varCustomerId2);
|
|
|
+
|
|
|
+ if (varCustomerId.vt == VT_NULL || varCustomerId.vt == VT_EMPTY)
|
|
|
+ rsGroupMember->PutCollect(_T("GM_Master"), 1);// 主联系人;
|
|
|
+ else
|
|
|
+ rsGroupMember->PutCollect(_T("GM_Master"), 0);// 主联系人;
|
|
|
+
|
|
|
+ rsGroupMember->PutCollect(_T("GM_ProtagonistCustomer"), 1);//拍照对象;
|
|
|
+
|
|
|
+ // 男宾ID;
|
|
|
+ if (varCustomerId.vt != VT_NULL && varCustomerId.vt != VT_EMPTY)
|
|
|
+ {
|
|
|
+ rsGroupMember->PutCollect(_T("GM_RelatedPersonID"), varCustomerId);
|
|
|
+ rsGroupMember->PutCollect(_T("GM_Relation"), _T("夫妻"));//家长没有性别,无法判断是父还是母;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ rsGroupMember->PutCollect(_T("GM_RelatedPersonID"), varCustomerId2);
|
|
|
+ rsGroupMember->PutCollect(_T("GM_Relation"), _T("本人"));//家长没有性别,无法判断是父还是母;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsGroupMember->PutCollect(_T("GM_IsOrder"), 1);
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ rsGroupMember->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsGroupMember->Close();
|
|
|
+ }
|
|
|
+ }();
|
|
|
+ }
|
|
|
+
|
|
|
+ //rsCustomer->PutCollect(_T("Cus_DividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ }
|
|
|
+
|
|
|
+ rsClient->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsCustomer->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d,%s =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, varClassicOrder.bstrVal, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pOrderGoods(_variant_t & varClassicOrder, _variant_t & varPlatinumOrder, _RecordsetPtr pcRecordSet)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+#ifdef _DEBUG
|
|
|
+
|
|
|
+ if (_tcscmp(varClassicOrder.bstrVal, _T("20170817-026")) == 0)
|
|
|
+ {
|
|
|
+ WriteTextLog(_T("c2pOrderGoods"));
|
|
|
+ }
|
|
|
+
|
|
|
+#endif
|
|
|
+ CString strSql;
|
|
|
+ _RecordsetPtr rsdindansp;
|
|
|
+ rsdindansp.CreateInstance(__uuidof(Recordset));
|
|
|
+ strSql.Format(_T("select * from dindansp where id = '%s'"), varClassicOrder.bstrVal);
|
|
|
+ // 根据dindan.id查询出dindansp表;
|
|
|
+ HRESULT hr = rsdindansp->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ _RecordsetPtr rsOrderProduct;
|
|
|
+ rsOrderProduct.CreateInstance(__uuidof(Recordset));
|
|
|
+ hr = rsOrderProduct->Open(_T("select * from tb_ErpOrderProductList"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ int nOrderbyNumber = 0;
|
|
|
+
|
|
|
+ while (rsdindansp->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ // 遍历dindansp结果表, 逐步转换;
|
|
|
+ [&, this]() {
|
|
|
+ _RecordsetPtr rsGoods;
|
|
|
+ rsGoods.CreateInstance(__uuidof(Recordset));
|
|
|
+ //strSql.Format(_T("select * from tb_ErpProduct where Prod_Name = '%s' and c2p_spid = '%s'"), rsdindansp->GetCollect(_T("name")).bstrVal, rsdindansp->GetCollect(_T("spid")).bstrVal);
|
|
|
+ strSql.Format(_T("select * from tb_ErpProduct where Prod_Name = '%s' "), rsdindansp->GetCollect(_T("name")).bstrVal);
|
|
|
+ hr = rsGoods->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ if (rsGoods->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ // 有商品记录;
|
|
|
+ nOrderbyNumber++;
|
|
|
+ _variant_t OPlist_UniquelyIdentity = [&, this]()->_variant_t {
|
|
|
+ TCHAR szResult[50] = { 0 };
|
|
|
+ _stprintf_s(szResult, _T("%s%s%ld"), Global::g_szClassicBranchId, rsGoods->GetCollect("Prod_Number").bstrVal, rsdindansp->GetCollect(_T("autoid")).intVal);
|
|
|
+ return szResult;
|
|
|
+ }();
|
|
|
+
|
|
|
+ // "shuliang"字段可能包含中文;
|
|
|
+ int shuliang = 0;
|
|
|
+
|
|
|
+ if (rsdindansp->GetCollect(_T("shuliang")).vt == VT_EMPTY || rsdindansp->GetCollect(_T("shuliang")).vt == VT_NULL || _tcscmp(rsdindansp->GetCollect(_T("shuliang")).bstrVal, _T("")) == 0)
|
|
|
+ shuliang = 0;
|
|
|
+ else
|
|
|
+ shuliang = _ttoi(rsdindansp->GetCollect(_T("shuliang")).bstrVal);
|
|
|
+
|
|
|
+ {
|
|
|
+ // type = 1;
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ rsOrderProduct->AddNew();
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_DividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_OrderNumber"), varPlatinumOrder);
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_ViceNumber"), [&, this]()->_variant_t {
|
|
|
+ TCHAR szViceNumber[50] = { 0 };
|
|
|
+ _stprintf_s(szViceNumber, _T("%s_001"), varPlatinumOrder.bstrVal);
|
|
|
+ return szViceNumber;
|
|
|
+ }());
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_ProdNumber"), rsGoods->GetCollect("Prod_Number"));
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_Type"), 1);
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_ProdName"), rsGoods->GetCollect(_T("Prod_Name")));
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_Class"), rsGoods->GetCollect(_T("Prod_Class")));
|
|
|
+ // 经典版没有批的概念,固为0 或者使用商品自带的;
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_Batch"), rsGoods->GetCollect(_T("Prod_Batch")));
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_Unit"), rsGoods->GetCollect(_T("Prod_Unit")));
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_CostPrice"), rsGoods->GetCollect(_T("Prod_CostPrice")));
|
|
|
+ //PRICENULL(rsOrderProduct, _T("OPlist_CostPrice"), rsGoods->GetCollect(_T("Prod_CostPrice")));//或者dindansp里的;
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_ProdSoldPrice"), rsGoods->GetCollect(_T("Prod_SalesPrice")));
|
|
|
+ //PRICENULL(rsOrderProduct, _T("OPlist_ProdSoldPrice"), rsGoods->GetCollect(_T("Prod_SalesPrice")));//或者dindansp里的;
|
|
|
+ // 商品数量;
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_ProdQuantity"), shuliang);
|
|
|
+ // 是否加急;
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_IsExpedited"), 0);
|
|
|
+ // 取件状态;
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_PickupStatus"), 0);
|
|
|
+ // 取走数量
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_PickupQuantity"), 0);
|
|
|
+ // 发出状态;// 根据发出日期;
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_SendStatus"), 0);
|
|
|
+ // 返工状态;
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_ReworkStatus"), 0);
|
|
|
+ // 返工数量,全部;
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_ReworQuantity"), 0);
|
|
|
+ // 完成状态;
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_CompletedStatus"), 0);
|
|
|
+ // 完件数量;
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_CompletedQuantity"), 0);
|
|
|
+ // 生成日期;
|
|
|
+ //rsOrderProduct->PutCollect(_T("OPlist_CreateDatetime"), pcRecordSet->GetCollect(_T("time1")));
|
|
|
+ DATENULL(rsOrderProduct, _T("OPlist_CreateDatetime"), pcRecordSet->GetCollect(_T("time1")));
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_OrderByNumber"), nOrderbyNumber);
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_IsSendOuntRemind"), 1);
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_UniquelyIdentity"), OPlist_UniquelyIdentity);
|
|
|
+ // 没有此项;
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_CompletedHadLessQuantity"), 0);
|
|
|
+ rsOrderProduct->Update();
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ }
|
|
|
+
|
|
|
+ {
|
|
|
+ // type = 2;
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ rsOrderProduct->AddNew();
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_DividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_OrderNumber"), varPlatinumOrder);
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_ViceNumber"), [&, this]()->_variant_t {
|
|
|
+ TCHAR szViceNumber[50] = { 0 };
|
|
|
+ _stprintf_s(szViceNumber, _T("%s_001"), varPlatinumOrder.bstrVal);
|
|
|
+ return szViceNumber;
|
|
|
+ }());
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_ProdNumber"), rsGoods->GetCollect("Prod_Number"));
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_Type"), 2);
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_ProdName"), rsGoods->GetCollect(_T("Prod_Name")));
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_Class"), rsGoods->GetCollect(_T("Prod_Class")));
|
|
|
+ // 经典版没有批的概念,固为0 或者使用商品自带的;
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_Batch"), rsGoods->GetCollect(_T("Prod_Batch")));
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_Unit"), rsGoods->GetCollect(_T("Prod_Unit")));
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_CostPrice"), rsGoods->GetCollect(_T("Prod_CostPrice")));//或者dindansp里的;
|
|
|
+ //PRICENULL(rsOrderProduct, _T("OPlist_CostPrice"), rsGoods->GetCollect(_T("Prod_CostPrice")));
|
|
|
+ //rsOrderProduct->PutCollect(_T("OPlist_ProdSoldPrice"), rsdindansp->GetCollect(_T("price")));
|
|
|
+ PRICENULL(rsOrderProduct, _T("OPlist_ProdSoldPrice"), rsdindansp->GetCollect(_T("price")));
|
|
|
+ // 商品数量;
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_ProdQuantity"), shuliang);
|
|
|
+ // 是否加急;
|
|
|
+ _variant_t urgent = rsdindansp->GetCollect(_T("urgent"));
|
|
|
+
|
|
|
+ if (urgent.vt == VT_EMPTY || urgent.vt == VT_NULL || _tcscmp(urgent.bstrVal, _T("")) == 0 || _tcscmp(urgent.bstrVal, _T("否")) == 0)
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_IsExpedited"), 0);
|
|
|
+ else
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_IsExpedited"), 1);
|
|
|
+
|
|
|
+ // 加急日期=经典取件日期;
|
|
|
+ DATENULL(rsOrderProduct, _T("OPlist_ExpeditedTime"), rsdindansp->GetCollect(_T("taketime")));
|
|
|
+ // 取件状态;
|
|
|
+ _variant_t status2 = rsdindansp->GetCollect(_T("status2"));
|
|
|
+
|
|
|
+ if (status2.vt == VT_EMPTY || status2.vt == VT_NULL || _tcscmp(status2.bstrVal, _T("")) == 0 || _tcscmp(status2.bstrVal, _T("未取")) == 0)
|
|
|
+ {
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_PickupQuantity"), 0);
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_PickupStatus"), 0);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_PickupStatus"), 1);
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_PickupQuantity"), shuliang);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 取走日期;
|
|
|
+ DATENULL(rsOrderProduct, _T("OPlist_PickupTime"), rsdindansp->GetCollect(_T("date4")));
|
|
|
+ // 取件师;
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_PickupName"), c2pGetEmployeeId(rsdindansp->GetCollect(_T("name4"))));
|
|
|
+
|
|
|
+ // 发出状态;// 根据发出日期;
|
|
|
+ _variant_t date1 = rsdindansp->GetCollect(_T("date1"));
|
|
|
+
|
|
|
+ if (date1.vt == VT_NULL || date1.vt == VT_EMPTY || _tcscmp(date1.bstrVal, _T("")) == 0)
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_SendStatus"), 0);
|
|
|
+ else
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_SendStatus"), 1);
|
|
|
+
|
|
|
+ // 发出商家;
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_SendVendor"), [&, this]()->_variant_t {
|
|
|
+ _variant_t status3 = rsdindansp->GetCollect(_T("status3"));
|
|
|
+
|
|
|
+ if (status3.vt == VT_EMPTY || status3.vt == VT_NULL || _tcscmp(status3.bstrVal, _T("")) == 0)
|
|
|
+ {
|
|
|
+ return _T("");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CString strVender = status3.bstrVal;
|
|
|
+ int nIndex = strVender.Find(_T("发出"));
|
|
|
+
|
|
|
+ if (nIndex != -1)
|
|
|
+ {
|
|
|
+ strVender = strVender.Mid(2);
|
|
|
+ return _variant_t(strVender);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return _T("");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }());
|
|
|
+ DATENULL(rsOrderProduct, _T("OPlist_SendTime"), date1);
|
|
|
+
|
|
|
+ // 返工时间;
|
|
|
+ _variant_t date2 = rsdindansp->GetCollect(_T("date2"));
|
|
|
+ _variant_t status4 = rsdindansp->GetCollect(_T("status4"));
|
|
|
+ DATENULL(rsOrderProduct, _T("OPlist_ReworkTime"), date2);
|
|
|
+
|
|
|
+ if (date2.vt == VT_EMPTY || date2.vt == VT_NULL || _tcscmp(date2.bstrVal, _T("")) == 0)
|
|
|
+ {
|
|
|
+ // 返工状态;
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_ReworkStatus"), 0);
|
|
|
+ // 返工数量,全部;
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_ReworQuantity"), shuliang);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // 返工状态;
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_ReworkStatus"), 1);
|
|
|
+ // 返工数量,全部;
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_ReworQuantity"), shuliang);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 返工记录者;
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_ReworName"), c2pGetEmployeeId(rsdindansp->GetCollect(_T("name2"))));
|
|
|
+
|
|
|
+ if (status4.vt != VT_NULL && status4.vt != VT_EMPTY && _tcscmp(status4.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ CString strStatus4 = status4.bstrVal;
|
|
|
+
|
|
|
+ if (strStatus4 == _T("返工/(工厂)"))
|
|
|
+ {
|
|
|
+ // 返回原因:工厂或员工;
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_ReworkRemark"), _T("工厂"));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ strStatus4.Delete(0, 4);
|
|
|
+ strStatus4.Delete(strStatus4.GetLength() - 1);
|
|
|
+ // 返回原因:工厂或员工;
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_ReworkRemark"), _variant_t(strStatus4));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 完成状态;
|
|
|
+ _variant_t status1 = rsdindansp->GetCollect(_T("status1"));
|
|
|
+
|
|
|
+ // 完成时间;
|
|
|
+ DATENULL(rsOrderProduct, _T("OPlist_CompletedTime"), rsdindansp->GetCollect(_T("date3")));
|
|
|
+ // 完件员工;
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_CompletedName"), c2pGetEmployeeId(rsdindansp->GetCollect(_T("name3"))));
|
|
|
+
|
|
|
+ // 完件数量;
|
|
|
+ if (status1.vt == VT_EMPTY || status1.vt == VT_NULL || _tcscmp(status1.bstrVal, _T("")) == 0 || _tcscmp(status1.bstrVal, _T("未完成")) == 0)
|
|
|
+ {
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_CompletedStatus"), 0);
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_CompletedQuantity"), 0);
|
|
|
+ }
|
|
|
+ else if (_tcscmp(status1.bstrVal, _T("OK")) == 0)
|
|
|
+ {
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_CompletedStatus"), 1);
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_CompletedQuantity"), shuliang);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 生成日期;
|
|
|
+ DATENULL(rsOrderProduct, _T("OPlist_CreateDatetime"), pcRecordSet->GetCollect(_T("time1")));
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_OrderByNumber"), nOrderbyNumber);
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_IsSendOuntRemind"), 1);
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_UniquelyIdentity"), OPlist_UniquelyIdentity);
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_Remark"), rsdindansp->GetCollect(_T("bz")));
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_CompletedHadLessQuantity"), 0);
|
|
|
+ // 单价;//OPlist_CompletedHadLessQuantity
|
|
|
+ //rsOrderProduct->PutCollect(_T("OPlist_UnitPrice"), rsdindansp->GetCollect(_T("date1")));
|
|
|
+ //rsOrderProduct->PutCollect(_T("OPlist_ProdWidth"), rsdindansp->GetCollect(_T("date1")));
|
|
|
+ //rsOrderProduct->PutCollect(_T("OPlist_ProdHeight"), rsdindansp->GetCollect(_T("date1")));
|
|
|
+ // 预约取件人员和时间;
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_ReservationTakeDividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_ReservationTakeName"), c2pGetEmployeeId(pcRecordSet->GetCollect(_T("waiter9"))));
|
|
|
+ rsOrderProduct->PutCollect(_T("OPlist_ReservationTakeTime"), [&, this]()->_variant_t {
|
|
|
+ _variant_t result;
|
|
|
+ _variant_t date = pcRecordSet->GetCollect(_T("time5"));
|
|
|
+ _variant_t time = pcRecordSet->GetCollect(_T("datetime5"));
|
|
|
+
|
|
|
+ if (date.vt != VT_EMPTY && date.vt != VT_NULL && _tcscmp(date.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ CString strdate;
|
|
|
+
|
|
|
+ if (time.vt != VT_EMPTY && time.vt != VT_NULL)
|
|
|
+ {
|
|
|
+ strdate.Format(_T("%s %s"), date.bstrVal, time.bstrVal);
|
|
|
+
|
|
|
+ // time可能包含中文字符;
|
|
|
+ if (strdate.SpanIncluding(_T("0123456789:- ")).IsEmpty())
|
|
|
+ strdate.Format(_T("%s"), date.bstrVal);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ strdate.Format(_T("%s"), date.bstrVal);
|
|
|
+ }
|
|
|
+
|
|
|
+ DATE dt = String2Date(strdate);
|
|
|
+
|
|
|
+ if (dt > 0) //1899年;
|
|
|
+ result = dt;
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }());
|
|
|
+
|
|
|
+ rsOrderProduct->Update();
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ rsGoods->Close();
|
|
|
+ }
|
|
|
+ }();
|
|
|
+
|
|
|
+ rsdindansp->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsOrderProduct->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsdindansp->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d,%s =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, varClassicOrder.bstrVal, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pRecordOfOrderReceipts(_variant_t & varClassicOrder, _variant_t & varPlatinumOrder, _RecordsetPtr pcRecordSet)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // dinanbukuan // tb_ErpPayment;
|
|
|
+ CString strSql;
|
|
|
+ _RecordsetPtr rsdindanbukuan;
|
|
|
+ rsdindanbukuan.CreateInstance(__uuidof(Recordset));
|
|
|
+ strSql.Format(_T("select * from dindanbukuan where id = '%s'"), varClassicOrder.bstrVal);
|
|
|
+ HRESULT hr = rsdindanbukuan->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ _RecordsetPtr rsErpPayment;
|
|
|
+ rsErpPayment.CreateInstance(__uuidof(Recordset));
|
|
|
+ hr = rsErpPayment->Open(_T("select * from tb_ErpPayment"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ _variant_t var;
|
|
|
+ _variant_t ViceNumber;
|
|
|
+
|
|
|
+ while (rsdindanbukuan->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ rsErpPayment->AddNew();
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ rsErpPayment->PutCollect(_T("c2p_order"), varClassicOrder);
|
|
|
+ rsErpPayment->PutCollect(_T("Pay_DividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ // 订单号;
|
|
|
+ rsErpPayment->PutCollect(_T("Pay_OrdNumber"), varPlatinumOrder);
|
|
|
+ rsErpPayment->PutCollect(_T("Pay_ViceNumber"), ViceNumber = [&, this]()->_variant_t {
|
|
|
+ TCHAR szViceNumber[50] = { 0 };
|
|
|
+ _stprintf_s(szViceNumber, _T("%s_001"), varPlatinumOrder.bstrVal);
|
|
|
+ return szViceNumber;
|
|
|
+ }());
|
|
|
+ var = rsdindanbukuan->GetCollect(_T("kind"));
|
|
|
+
|
|
|
+ if (_tcscmp(var.bstrVal, _T("3")) == 0)
|
|
|
+ {
|
|
|
+ // 预约补款;
|
|
|
+ rsErpPayment->PutCollect(_T("Pay_Category"), _T("预约补款"));
|
|
|
+ }
|
|
|
+ else if (_tcscmp(var.bstrVal, _T("4")) == 0)
|
|
|
+ {
|
|
|
+ // 预约收款;
|
|
|
+ var = pcRecordSet->GetCollect(_T("taoxijiage"));
|
|
|
+
|
|
|
+ if (var.vt != VT_NULL && var.vt != VT_EMPTY && _tcscmp(var.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ int nPrice = _ttoi(var.bstrVal);
|
|
|
+
|
|
|
+ if (nPrice == _ttoi(rsdindanbukuan->GetCollect(_T("money")).bstrVal))
|
|
|
+ {
|
|
|
+ // 全款;
|
|
|
+ rsErpPayment->PutCollect(_T("Pay_Category"), _T("全款"));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //预约收款;
|
|
|
+ rsErpPayment->PutCollect(_T("Pay_Category"), _T("预约收款"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ rsErpPayment->PutCollect(_T("Pay_Category"), _T("全款"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // 后期收款;
|
|
|
+ rsErpPayment->PutCollect(_T("Pay_Category"), _T("后期收款"));
|
|
|
+ //[Pay_ReceivableProject]
|
|
|
+ rsErpPayment->PutCollect(_T("Pay_ReceivableProject"), rsdindanbukuan->GetCollect(_T("item")));
|
|
|
+ //[Pay_PlusPickNumber]
|
|
|
+ rsErpPayment->PutCollect(_T("Pay_PlusPickNumber"), [&, this]()->_variant_t {
|
|
|
+ TCHAR szUID[24] = { 0 };
|
|
|
+ TCHAR szResult[50] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUID, 24, 10);
|
|
|
+ _stprintf_s(szResult, _T("PPI%s"), szUID);
|
|
|
+ return szResult;
|
|
|
+ }());
|
|
|
+ rsErpPayment->PutCollect(_T("Pay_ShootingName"), c2pGetScenicSpotByViceNumber(ViceNumber));
|
|
|
+ }
|
|
|
+
|
|
|
+ PRICENULL(rsErpPayment, _T("Pay_AmountOf"), rsdindanbukuan->GetCollect(_T("money")));
|
|
|
+ // 接单门市;[Pay_OpenSingle]
|
|
|
+ [&, this]() {
|
|
|
+ CString str;
|
|
|
+ _variant_t ren = pcRecordSet->GetCollect(_T("ren"));
|
|
|
+ _variant_t ren2 = pcRecordSet->GetCollect(_T("ren2"));
|
|
|
+
|
|
|
+ if (ren.vt != VT_EMPTY && ren.vt != VT_NULL && _tcscmp(ren.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ var = c2pGetEmployeeId(ren);
|
|
|
+
|
|
|
+ if (var.vt != VT_EMPTY && var.vt != VT_NULL && _tcscmp(var.bstrVal, _T("")) != 0)
|
|
|
+ str += var.bstrVal;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ren2.vt != VT_EMPTY && ren2.vt != VT_NULL && _tcscmp(ren2.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ if (!str.IsEmpty())
|
|
|
+ str += _T(",");
|
|
|
+
|
|
|
+ var = c2pGetEmployeeId(ren2);
|
|
|
+
|
|
|
+ if (var.vt != VT_EMPTY && var.vt != VT_NULL && _tcscmp(var.bstrVal, _T("")) != 0)
|
|
|
+ str += var.bstrVal;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsErpPayment->PutCollect(_T("Pay_OpenSingle"), _variant_t(str));
|
|
|
+ }();
|
|
|
+ // Pay_CreateName收款人;
|
|
|
+ var = rsdindanbukuan->GetCollect(_T("ren"));
|
|
|
+
|
|
|
+ if (var.vt != VT_EMPTY && var.vt != VT_NULL && _tcscmp(var.bstrVal, _T("")) != 0)
|
|
|
+ rsErpPayment->PutCollect(_T("Pay_CreateName"), var);
|
|
|
+
|
|
|
+ // 录单人;
|
|
|
+ var = rsdindanbukuan->GetCollect(_T("ren2"));
|
|
|
+
|
|
|
+ if (var.vt != VT_EMPTY && var.vt != VT_NULL && _tcscmp(var.bstrVal, _T("")) != 0)
|
|
|
+ rsErpPayment->PutCollect(_T("Pay_ThePayee"), var);
|
|
|
+
|
|
|
+ // Pay_PaymentMethod 收款方式;
|
|
|
+ var = rsdindanbukuan->GetCollect(_T("paytype"));
|
|
|
+
|
|
|
+ if (var.vt != VT_EMPTY && var.vt != VT_NULL && _tcscmp(var.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ //var = c2pGetPaymentMethodClass(var);
|
|
|
+ rsErpPayment->PutCollect(_T("Pay_PaymentMethod"), c2pGetPaymentMethodClass(var));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 接单点;
|
|
|
+ rsErpPayment->PutCollect(_T("Pay_OrdersLocation"), rsdindanbukuan->GetCollect(_T("jdd")));
|
|
|
+ //审核是否通过\审核人;
|
|
|
+ [&, this]() {
|
|
|
+ var = rsdindanbukuan->GetCollect(_T("financecheck"));
|
|
|
+
|
|
|
+ if (var.vt != VT_EMPTY && var.vt != VT_NULL && _tcscmp(var.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ CString str = var.bstrVal;
|
|
|
+ int nIndex = str.Find(_T("\\"));
|
|
|
+
|
|
|
+ if (nIndex != -1)
|
|
|
+ {
|
|
|
+ rsErpPayment->PutCollect(_T("Pay_FinancialAudit"), _variant_t(str.Left(nIndex)));
|
|
|
+ rsErpPayment->PutCollect(_T("Pay_FinancialAuditdPeople"), c2pGetEmployeeId(_variant_t(str.Mid(nIndex + 1))));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }();
|
|
|
+ // 生成日期;[Pay_CreateDatetime]
|
|
|
+ DATENULL(rsErpPayment, _T("Pay_CreateDatetime"), rsdindanbukuan->GetCollect(_T("date")));
|
|
|
+ // Pay_Type收款类型 (0:订单,1:其他消费 2:礼服)
|
|
|
+ rsErpPayment->PutCollect(_T("Pay_Type"), 0);
|
|
|
+ // 折扣;
|
|
|
+ var = rsdindanbukuan->GetCollect(_T("discount"));
|
|
|
+
|
|
|
+ if (var.vt != VT_EMPTY && var.vt != VT_NULL && _tcscmp(var.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ float fdis = _ttof(var.bstrVal);
|
|
|
+ rsErpPayment->PutCollect(_T("Pay_PaymentDiscount"), fdis);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ rsErpPayment->PutCollect(_T("Pay_PaymentDiscount"), 0.0);
|
|
|
+ }
|
|
|
+
|
|
|
+ rsErpPayment->PutCollect(_T("Pay_DiscountAmount"), 0.0);
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ rsErpPayment->Update();
|
|
|
+ // 下一条;
|
|
|
+ rsdindanbukuan->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsErpPayment->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsdindanbukuan->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d,%s =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, varClassicOrder.bstrVal, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pOrderReceiptsItem(_variant_t & varClassicOrder, _variant_t & varPlatinumOrder, _RecordsetPtr pcRecordSet)
|
|
|
+{
|
|
|
+#ifdef _DEBUG
|
|
|
+
|
|
|
+ if (_tcscmp(varClassicOrder.bstrVal, _T("20140102-001")) == 0)
|
|
|
+ {
|
|
|
+ WriteTextLog(_T("c2pOrderReceiptsItem"));
|
|
|
+ }
|
|
|
+
|
|
|
+#endif
|
|
|
+
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // dindanbukuan2; // tb_ErpPlusPickItems;
|
|
|
+ CString strSql;
|
|
|
+ _RecordsetPtr rsdindanbukuan2;
|
|
|
+ rsdindanbukuan2.CreateInstance(__uuidof(Recordset));
|
|
|
+ strSql.Format(_T("select * from dindanbukuan2 where id = '%s'"), varClassicOrder.bstrVal);
|
|
|
+ HRESULT hr = rsdindanbukuan2->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ _RecordsetPtr rsErpPickItem;
|
|
|
+ rsErpPickItem.CreateInstance(__uuidof(Recordset));
|
|
|
+ hr = rsErpPickItem->Open(_T("select * from tb_ErpPlusPickItems"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ _variant_t var;
|
|
|
+
|
|
|
+ while (rsdindanbukuan2->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ rsErpPickItem->AddNew();
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ rsErpPickItem->PutCollect(_T("Plu_DividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ // 订单号;
|
|
|
+ rsErpPickItem->PutCollect(_T("Plu_OrdNumber"), varPlatinumOrder);
|
|
|
+ rsErpPickItem->PutCollect(_T("Plu_OrdViceNumber"), [&, this]()->_variant_t {
|
|
|
+ TCHAR szViceNumber[50] = { 0 };
|
|
|
+ _stprintf_s(szViceNumber, _T("%s_001"), varPlatinumOrder.bstrVal);
|
|
|
+ return szViceNumber;
|
|
|
+ }());
|
|
|
+
|
|
|
+ // 加挑编号,二销类型;[Plu_TwoPinsCategory]
|
|
|
+ [&, this]() {
|
|
|
+ // 加挑编号;
|
|
|
+ _RecordsetPtr rs;
|
|
|
+ rs.CreateInstance(__uuidof(Recordset));
|
|
|
+ strSql.Format(_T("select * from tb_ErpPayment where c2p_order = '%s' and Pay_ReceivableProject = '%s' and Pay_Category = '后期收款'"),
|
|
|
+ varClassicOrder.bstrVal, rsdindanbukuan2->GetCollect(_T("bz")).bstrVal);
|
|
|
+ hr = rs->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ if (rs->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ rsErpPickItem->PutCollect(_T("Plu_Number"), rs->GetCollect(_T("Pay_PlusPickNumber")));
|
|
|
+ rsErpPickItem->PutCollect(_T("Plu_TwoPinsCategory"), rs->GetCollect(_T("Pay_TwoPinsCategory")));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // 有些没有找收款的, 经典版里找不到这两个参数,只能随意生成;
|
|
|
+ rsErpPickItem->PutCollect(_T("Plu_Number"), [&, this]()->_variant_t {
|
|
|
+ TCHAR szUID[24] = { 0 };
|
|
|
+ TCHAR szResult[50] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUID, 24, 10);
|
|
|
+ _stprintf_s(szResult, _T("PPI%s"), szUID);
|
|
|
+ return szResult;
|
|
|
+ }());
|
|
|
+ // 默认选片二销;
|
|
|
+ rsErpPickItem->PutCollect(_T("Plu_TwoPinsCategory"), c2pGetPaymentMethodClass(_variant_t(_T("选片二销"))));
|
|
|
+ }
|
|
|
+
|
|
|
+ rs->Close();
|
|
|
+ }
|
|
|
+ }();
|
|
|
+ // 加挑金额;
|
|
|
+ PRICENULL(rsErpPickItem, _T("Plu_Amount"), rsdindanbukuan2->GetCollect(_T("money")));
|
|
|
+ // 加挑物品;[Plu_Goods]
|
|
|
+ rsErpPickItem->PutCollect(_T("Plu_Goods"), rsdindanbukuan2->GetCollect(_T("bz")));
|
|
|
+ // 接单门市;[Plu_OpenSingle]
|
|
|
+ [&, this]() {
|
|
|
+ CString str;
|
|
|
+ _variant_t ren = pcRecordSet->GetCollect(_T("ren"));
|
|
|
+ _variant_t ren2 = pcRecordSet->GetCollect(_T("ren2"));
|
|
|
+
|
|
|
+ if (ren.vt != VT_EMPTY && ren.vt != VT_NULL && _tcscmp(ren.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ var = c2pGetEmployeeId(ren);
|
|
|
+
|
|
|
+ if (var.vt != VT_EMPTY && var.vt != VT_NULL && _tcscmp(var.bstrVal, _T("")) != 0)
|
|
|
+ str += var.bstrVal;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ren2.vt != VT_EMPTY && ren2.vt != VT_NULL && _tcscmp(ren2.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ if (!str.IsEmpty())
|
|
|
+ str += _T(",");
|
|
|
+
|
|
|
+ var = c2pGetEmployeeId(ren2);
|
|
|
+
|
|
|
+ if (var.vt != VT_EMPTY && var.vt != VT_NULL && _tcscmp(var.bstrVal, _T("")) != 0)
|
|
|
+ str += var.bstrVal;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsErpPickItem->PutCollect(_T("Plu_OpenSingle"), _variant_t(str));
|
|
|
+ }();
|
|
|
+ // 录单人[Plu_RecordedPerson];
|
|
|
+ var = rsdindanbukuan2->GetCollect(_T("ren2"));
|
|
|
+
|
|
|
+ if (var.vt != VT_EMPTY && var.vt != VT_NULL && _tcscmp(var.bstrVal, _T("")) != 0)
|
|
|
+ rsErpPickItem->PutCollect(_T("Plu_RecordedPerson"), var);
|
|
|
+
|
|
|
+ // 生成日期;[[Plu_CreateTime]]
|
|
|
+ DATENULL(rsErpPickItem, _T("Plu_CreateTime"), rsdindanbukuan2->GetCollect(_T("date")));
|
|
|
+ // [Plu_SourceType]0 为后期二销 1 为选片加挑二销
|
|
|
+ rsErpPickItem->PutCollect(_T("Plu_SourceType"), 0);
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ rsErpPickItem->Update();
|
|
|
+ // 下一条;
|
|
|
+ rsdindanbukuan2->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsErpPickItem->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsdindanbukuan2->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d,%s =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, varClassicOrder.bstrVal, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pOrderSelection(c2pSelection & c2pslt)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+#ifdef _DEBUG
|
|
|
+
|
|
|
+ if (c2pslt.strOrder == _T("20170817-026"))
|
|
|
+ {
|
|
|
+ WriteTextLog(_T("c2pOrderSelection"));
|
|
|
+ }
|
|
|
+
|
|
|
+#endif
|
|
|
+ CString strtmp;
|
|
|
+ CString strno;
|
|
|
+ CString strno2;
|
|
|
+ CString strSelection1;
|
|
|
+ CString strSelection2;
|
|
|
+ CString strSql;
|
|
|
+ CString strNoResult;
|
|
|
+ CString strNo2Result;
|
|
|
+ CString strViceNumber;
|
|
|
+ strViceNumber.Format(_T("%s%s_001"), Global::g_szClassicBranchId, c2pslt.strOrder);
|
|
|
+
|
|
|
+ for (c2pSelectionItem item : c2pslt.vtItems)
|
|
|
+ {
|
|
|
+ if (!item.strNo.IsEmpty())
|
|
|
+ {
|
|
|
+ // 选片;
|
|
|
+ // 入册与入底,不用获取商品id;
|
|
|
+ if (item.strSpName == _T("入底") || item.strSpName == _T("入册"))
|
|
|
+ strtmp.Format(_T("%s?%s:"), item.strSpName, item.strSpName);
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _variant_t proUid = c2pGetOrderProductUId(_variant_t(item.strSpName), _variant_t(strViceNumber));
|
|
|
+ strtmp.Format(_T("%s?%s:"), item.strSpName, (proUid.vt == VT_EMPTY || proUid.vt == VT_NULL) ? _T("") : proUid.bstrVal);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 经典版是否加密;
|
|
|
+ if (item.strNo.Left(3) == _T("<?>"))
|
|
|
+ {
|
|
|
+ item.strNo.Delete(0, 3);
|
|
|
+ des_crypt(item.strNo, item.strNo, DES_DECRYPT);
|
|
|
+ }
|
|
|
+
|
|
|
+ item.strNo.TrimRight(_T("|"));
|
|
|
+ item.strNo += _T("|");
|
|
|
+ item.strNo.Replace(_T("|"), _T(".JPG?"));
|
|
|
+ item.strNo.TrimRight(_T("?"));
|
|
|
+ strtmp += item.strNo;
|
|
|
+
|
|
|
+ if (!strno.IsEmpty())
|
|
|
+ strno += _T("|");
|
|
|
+
|
|
|
+ strno += strtmp;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!item.strNo2.IsEmpty())
|
|
|
+ {
|
|
|
+ // 选版;
|
|
|
+ // 入册与入底,不用获取商品id;
|
|
|
+ if (item.strSpName == _T("入底") || item.strSpName == _T("入册"))
|
|
|
+ strtmp.Format(_T("%s?%s:"), item.strSpName, item.strSpName);
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _variant_t proUid = c2pGetOrderProductUId(_variant_t(item.strSpName), _variant_t(strViceNumber));
|
|
|
+ strtmp.Format(_T("%s?%s:"), item.strSpName, (proUid.vt == VT_EMPTY || proUid.vt == VT_NULL) ? _T("") : proUid.bstrVal);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 经典版是否加密;
|
|
|
+ if (item.strNo2.Left(3) == _T("<?>"))
|
|
|
+ {
|
|
|
+ item.strNo2.Delete(0, 3);
|
|
|
+ des_crypt(item.strNo2, item.strNo2, DES_DECRYPT);
|
|
|
+ }
|
|
|
+
|
|
|
+ item.strNo2.TrimRight(_T("|"));
|
|
|
+ item.strNo2 += _T("|");
|
|
|
+ item.strNo2.Replace(_T("|"), _T(".JPG?"));
|
|
|
+ item.strNo2.TrimRight(_T("?"));
|
|
|
+ strtmp += item.strNo2;
|
|
|
+
|
|
|
+ if (!strno2.IsEmpty())
|
|
|
+ strno2 += _T("|");
|
|
|
+
|
|
|
+ strno2 += strtmp;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ // 选片;
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ {
|
|
|
+ strNoResult += _T("*");
|
|
|
+ strtmp = c2pslt.strbz3;
|
|
|
+ strtmp += _T("?");
|
|
|
+ // 相片说明;
|
|
|
+ c2pslt.strbz4.Replace(_T(":"), _T(".JPG:"));
|
|
|
+ c2pslt.strbz4.Replace(_T(" "), _T("|"));// 两空格;
|
|
|
+ strtmp += c2pslt.strbz4;
|
|
|
+ strNoResult += EncodeHex16String(strtmp);
|
|
|
+
|
|
|
+ // 删除的相片;
|
|
|
+ strNoResult += _T("*");
|
|
|
+ c2pslt.strDelphotos.TrimLeft(_T("|"));
|
|
|
+
|
|
|
+ if (!c2pslt.strDelphotos.IsEmpty())
|
|
|
+ {
|
|
|
+ if (c2pslt.strDelphotos.Left(3) == _T("<?>"))
|
|
|
+ {
|
|
|
+ c2pslt.strDelphotos.Delete(0, 3);
|
|
|
+ des_crypt(c2pslt.strDelphotos, c2pslt.strDelphotos, DES_DECRYPT);
|
|
|
+ }
|
|
|
+
|
|
|
+ c2pslt.strDelphotos.TrimRight(_T("|"));
|
|
|
+ c2pslt.strDelphotos += _T("|");
|
|
|
+ c2pslt.strDelphotos.Replace(_T("|"), _T(".JPG?"));
|
|
|
+ c2pslt.strDelphotos.TrimRight(_T("?"));
|
|
|
+ strNoResult += c2pslt.strDelphotos;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (strNoResult == _T("*003F*"))
|
|
|
+ {
|
|
|
+ //WriteTextLog(_T("订单号:%s,%s\n"), c2pslt.strOrder,strNoResult);
|
|
|
+ strSelection1 = strno;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //WriteTextLog(_T("订单号:%s,%s\n"), c2pslt.strOrder, strno + strNoResult);
|
|
|
+ strSelection1 = strno + strNoResult;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ // 选版;
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ {
|
|
|
+ strNo2Result += _T("*");
|
|
|
+ strtmp = c2pslt.strbz2;
|
|
|
+ strtmp += _T("?");
|
|
|
+ // 相片说明;
|
|
|
+ c2pslt.strbz5.Replace(_T(":"), _T(".JPG:"));
|
|
|
+ c2pslt.strbz5.Replace(_T(" "), _T("|"));// 两空格;
|
|
|
+ strtmp += c2pslt.strbz5;
|
|
|
+ strNo2Result += EncodeHex16String(strtmp);
|
|
|
+
|
|
|
+ // 删除的相片;
|
|
|
+ strNo2Result += _T("*");
|
|
|
+ c2pslt.strDelphotos2.TrimLeft(_T("|"));
|
|
|
+
|
|
|
+ if (!c2pslt.strDelphotos2.IsEmpty())
|
|
|
+ {
|
|
|
+ if (c2pslt.strDelphotos2.Left(3) == _T("<?>"))
|
|
|
+ {
|
|
|
+ c2pslt.strDelphotos2.Delete(0, 3);
|
|
|
+ des_crypt(c2pslt.strDelphotos2, c2pslt.strDelphotos2, DES_DECRYPT);
|
|
|
+ }
|
|
|
+
|
|
|
+ c2pslt.strDelphotos2.TrimRight(_T("|"));
|
|
|
+ c2pslt.strDelphotos2 += _T("|");
|
|
|
+ c2pslt.strDelphotos2.Replace(_T("|"), _T(".JPG?"));
|
|
|
+ c2pslt.strDelphotos2.TrimRight(_T("?"));
|
|
|
+ strNo2Result += c2pslt.strDelphotos2;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (strNo2Result == _T("*003F*"))
|
|
|
+ {
|
|
|
+ //WriteTextLog(_T("选版订单号:%s,%s\n"), c2pslt.strOrder, strNo2Result);
|
|
|
+ strSelection2 = strno2;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //WriteTextLog(_T("选版订单号:%s,%s\n"), c2pslt.strOrder, strno2 + strNo2Result);
|
|
|
+ strSelection2 = strno2 + strNo2Result;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ // 执行更新语句;
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ _CommandPtr m_pCommand;
|
|
|
+ m_pCommand.CreateInstance(__uuidof(Command));
|
|
|
+ // 将库连接赋于它;
|
|
|
+ m_pCommand->ActiveConnection = m_pPlatinumConnection;
|
|
|
+ // SQL语句;
|
|
|
+ strSql.Format(_T("UPDATE [dbo].[tb_ErpOrderDigital] SET [Ordv_SelectionFilm] = '%s',[Ordv_SelectionDesign] = '%s' WHERE [Ordv_ViceNumber] = '%s'"),
|
|
|
+ strSelection1,
|
|
|
+ strSelection2,
|
|
|
+ strViceNumber);
|
|
|
+ m_pCommand->CommandText = _bstr_t(strSql);
|
|
|
+ // 执行SQL语句,返回记录集
|
|
|
+ m_pRecordset = m_pCommand->Execute(NULL, NULL, adCmdText);
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d,订单=%s =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, c2pslt.strOrder, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+bool c2p::isChildOrderType(_variant_t varType)
|
|
|
+{
|
|
|
+ if (varType.vt == VT_EMPTY || varType.vt == VT_NULL || _tcscmp(varType.bstrVal, _T("")) == 0)
|
|
|
+ return false;
|
|
|
+
|
|
|
+ bool found = false;
|
|
|
+
|
|
|
+ for (std::wstring name : m_listResult)
|
|
|
+ {
|
|
|
+ if (_tcsicmp(name.c_str(), varType.bstrVal) == 0)
|
|
|
+ {
|
|
|
+ found = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return found;
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pOrderImg(CString strOrder)
|
|
|
+{
|
|
|
+ auto funs = [&, this](int nImgType, CString strOrder) {
|
|
|
+ // 根据订单号查找所有目录;
|
|
|
+ CStringArray AryOrderDir;
|
|
|
+
|
|
|
+ for (ShareDir item : m_vtShareDir)
|
|
|
+ {
|
|
|
+ if (item.photoType == nImgType)
|
|
|
+ {
|
|
|
+ CString strDir;
|
|
|
+
|
|
|
+ if (item.strBranchId.IsEmpty())
|
|
|
+ {
|
|
|
+ if (Global::g_bOurBranch)
|
|
|
+ strDir.Format(_T("%s\\%s\\"), item.strSharePath, strOrder);
|
|
|
+ else
|
|
|
+ strDir.Format(_T("%s\\%s\\%s\\"), item.strSharePath, m_strClassicDomain, strOrder);
|
|
|
+
|
|
|
+ AryOrderDir.Add(strDir);
|
|
|
+ }
|
|
|
+ else if (_tcscmp(item.strBranchId, m_strClassicDomain) == 0)
|
|
|
+ {
|
|
|
+ strDir.Format(_T("%s\\%s\\"), item.strSharePath, strOrder);
|
|
|
+ AryOrderDir.Add(strDir);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 铂金版订单号;
|
|
|
+ CString strPlatinumOrder;
|
|
|
+ strPlatinumOrder.Format(_T("%s%s"), Global::g_szClassicBranchId, strOrder);
|
|
|
+ CString strPlatinumDir;
|
|
|
+
|
|
|
+ if (nImgType == OImgtype)
|
|
|
+ strPlatinumDir.Format(_T("%s\\%s\\"), g_szPath1, strPlatinumOrder);
|
|
|
+ else if (nImgType == EImgtype)
|
|
|
+ strPlatinumDir.Format(_T("%s\\%s\\"), g_szPath2, strPlatinumOrder);
|
|
|
+ else if (nImgType == FImgtype)
|
|
|
+ strPlatinumDir.Format(_T("%s\\%s\\"), g_szPath3, strPlatinumOrder);
|
|
|
+ else if (nImgType == DImgtype)
|
|
|
+ strPlatinumDir.Format(_T("%s\\%s\\"), g_szPath4, strPlatinumOrder);
|
|
|
+
|
|
|
+ // 复制文件夹;
|
|
|
+ for (int i = 0; i < AryOrderDir.GetSize(); i++)
|
|
|
+ {
|
|
|
+ COPYFOLDER(AryOrderDir.GetAt(i), strPlatinumDir);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ funs(OImgtype, strOrder);
|
|
|
+ funs(EImgtype, strOrder);
|
|
|
+ funs(FImgtype, strOrder);
|
|
|
+ funs(DImgtype, strOrder);
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+void c2p::c2pOrderSubClass(_variant_t & varClassicOrder, _variant_t & varPlatinumOrder, _RecordsetPtr pcRecordSet)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+#ifdef _DEBUG
|
|
|
+
|
|
|
+ if (_tcscmp(varClassicOrder.bstrVal, _T("20120324-001")) == 0)
|
|
|
+ {
|
|
|
+ WriteTextLog(_T("c2pOrderScenicSpot"));
|
|
|
+ }
|
|
|
+
|
|
|
+#endif
|
|
|
+ CString strSql;
|
|
|
+ _RecordsetPtr rsdindanjd;
|
|
|
+ rsdindanjd.CreateInstance(__uuidof(Recordset));
|
|
|
+ strSql.Format(_T("select * from dindanjd where id = '%s'"), varClassicOrder.bstrVal);
|
|
|
+ HRESULT hr = rsdindanjd->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockReadOnly, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ int nSubId = 1;
|
|
|
+
|
|
|
+ while (rsdindanjd->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ // 生成子单;
|
|
|
+ _variant_t varSubId = [&, this]()->_variant_t {
|
|
|
+ TCHAR szSubID[50] = { 0 };
|
|
|
+ _stprintf_s(szSubID, _T("%s_%03d"), varPlatinumOrder.bstrVal, nSubId);
|
|
|
+ return szSubID;
|
|
|
+ }();
|
|
|
+
|
|
|
+ // 子单化景点;
|
|
|
+ c2pSubOrderScenicSpot(varSubId, varClassicOrder, varPlatinumOrder, rsdindanjd, pcRecordSet);
|
|
|
+ // 子单化数码;
|
|
|
+ c2pSubOrderDigital(nSubId, varSubId, varClassicOrder, varPlatinumOrder, rsdindanjd, pcRecordSet);
|
|
|
+ // 子单化数码状态;
|
|
|
+ c2pSubOrderDigitalStatus(nSubId, varSubId, varClassicOrder, varPlatinumOrder, rsdindanjd, pcRecordSet);
|
|
|
+
|
|
|
+ nSubId++;
|
|
|
+ rsdindanjd->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsdindanjd->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d,%s =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, varClassicOrder.bstrVal, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pSubOrderScenicSpot(_variant_t &varSubId, _variant_t & varClassicOrder, _variant_t & varPlatinumOrder, _RecordsetPtr rsdindanjd, _RecordsetPtr rsdindan)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // dindanjd; //tb_ErpOrdersPhotography;
|
|
|
+ // 判断子单是否存在;
|
|
|
+ CString strSql;
|
|
|
+ strSql.Format(_T("select * from tb_ErpOrdersPhotography where Ordpg_ViceNumber = '%s' and Ordpg_Sights = '%s'"),
|
|
|
+ varSubId.bstrVal, rsdindanjd->GetCollect(_T("name")).bstrVal);
|
|
|
+ _RecordsetPtr result = c2pQueryExspcits(strSql, m_pPlatinumConnection);
|
|
|
+
|
|
|
+ if (result == NULL || result->adoEOF == VARIANT_TRUE)
|
|
|
+ {
|
|
|
+ // 不存在;
|
|
|
+ if (rsdindanjd->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ _RecordsetPtr rsScenicSpot;
|
|
|
+ rsScenicSpot.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = rsScenicSpot->Open(_T("select * from tb_ErpOrdersPhotography"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ rsScenicSpot->AddNew();
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_IDNumber"), [&, this]()->_variant_t {
|
|
|
+ TCHAR szID[50] = { 0 };
|
|
|
+ TCHAR szResult[50] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szID, 50, 10);
|
|
|
+ _stprintf_s(szResult, _T("ORDS_%s"), &szID);
|
|
|
+ return szResult;
|
|
|
+ }());
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_Number"), varPlatinumOrder);
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_ViceNumber"), varSubId);
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_Sights"), rsdindanjd->GetCollect(_T("name")));
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_CostPrice"), 0);
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_SightsLevel"), _T("BEBBBCADDEBFJDFFC"));//景点等级,都是一级;
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_SightsType"), _T("0"));//景点类别 (0:内景 , 1:外景)//经典无此分类;
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_ApparelQuantity"), 0);//服装套数//经典无此分类;
|
|
|
+ // 摄影师;
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_Photographer"), c2pGetEmployeeId(rsdindan->GetCollect(_T("waiter1"))));
|
|
|
+ //拍摄时间;
|
|
|
+ DATENULL(rsScenicSpot, _T("Ordpg_PhotographyTime"), rsdindanjd->GetCollect(_T("date")));
|
|
|
+ //拍摄状态 0:未拍 1: OK(已拍) 2:拍照中
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_PhotographyStatus"), [&, this]()->_variant_t {
|
|
|
+ _variant_t var = rsdindanjd->GetCollect(_T("status"));
|
|
|
+
|
|
|
+ if (var.vt == VT_NULL || _tcscmp(var.bstrVal, _T("")) == 0 || _tcscmp(var.bstrVal, _T("未拍")) == 0)
|
|
|
+ return _T("0");
|
|
|
+ else if (_tcscmp(var.bstrVal, _T("OK")) == 0)
|
|
|
+ return _T("1");
|
|
|
+ else
|
|
|
+ return _T("2");
|
|
|
+ }());
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_PhotographyAssistant"), c2pGetEmployeeId(rsdindan->GetCollect(_T("waiter12"))));//摄影助理;
|
|
|
+
|
|
|
+ if (Global::g_bChildVersion)
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_BootDivision"), c2pGetEmployeeId(rsdindan->GetCollect(_T("waiter2"))));//引导师;
|
|
|
+ else
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_MakeupArtist"), c2pGetEmployeeId(rsdindan->GetCollect(_T("waiter2"))));//化妆师;
|
|
|
+
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_MakeupAssistant"), c2pGetEmployeeId(rsdindan->GetCollect(_T("waiter22"))));//化妆师助理;
|
|
|
+ // 预约拍照日期与时间;Ordpg_ReservationPhotographyDividedShop
|
|
|
+ //DATENULL(rsScenicSpot, _T("Ordpg_ReservationPhotographyTime"), rsdindanjd->GetCollect(_T("bookingdate")));
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_ReservationPhotographyTime"), [&, this]()->_variant_t {
|
|
|
+ _variant_t result;
|
|
|
+ _variant_t date = rsdindanjd->GetCollect(_T("bookingdate"));
|
|
|
+ _variant_t time = rsdindanjd->GetCollect(_T("time"));
|
|
|
+
|
|
|
+ if (date.vt != VT_EMPTY && date.vt != VT_NULL && _tcscmp(date.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ CString strdate;
|
|
|
+
|
|
|
+ if (time.vt != VT_EMPTY && time.vt != VT_NULL)
|
|
|
+ {
|
|
|
+ strdate.Format(_T("%s %s"), date.bstrVal, time.bstrVal);
|
|
|
+
|
|
|
+ // time可能包含中文字符;
|
|
|
+ if (strdate.SpanIncluding(_T("0123456789:- ")).IsEmpty())
|
|
|
+ strdate.Format(_T("%s"), date.bstrVal);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ strdate.Format(_T("%s"), date.bstrVal);
|
|
|
+ }
|
|
|
+
|
|
|
+ DATE dt = String2Date(strdate);
|
|
|
+
|
|
|
+ if (dt > 0) //1899年;
|
|
|
+ result = dt;
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }());
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_ReservationPhotographyDividedShop"), Global::g_szPlatinumBranchId);//预约分店;
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_ReservationPhotographyName"), c2pGetEmployeeId(rsdindanjd->GetCollect(_T("waiter1"))));//预约摄影师;
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_ReservationPhotographyAssistant"), c2pGetEmployeeId(rsdindanjd->GetCollect(_T("waiter12"))));//预约摄影师助理;
|
|
|
+
|
|
|
+ if (Global::g_bChildVersion)
|
|
|
+ {
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_ReservationBootDivision"), c2pGetEmployeeId(rsdindanjd->GetCollect(_T("waiter2"))));//预约引导师;
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_ReservationBootDivisionAssistant"), c2pGetEmployeeId(rsdindanjd->GetCollect(_T("waiter22"))));//预约引导师助理;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_ReservationMakeupArtist"), c2pGetEmployeeId(rsdindanjd->GetCollect(_T("waiter2"))));//预约化妆师;
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_ReservationMakeupAssistant"), c2pGetEmployeeId(rsdindanjd->GetCollect(_T("waiter22"))));//预约化妆师助理;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_Remark"), rsdindanjd->GetCollect(_T("bz")));
|
|
|
+ // 售价;
|
|
|
+ rsScenicSpot->PutCollect(_T("Ordpg_SalesPrice"), 0);
|
|
|
+ DATENULL(rsScenicSpot, _T("Ordpg_CreateDateTime"), rsdindan->GetCollect(_T("time1")));
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ rsScenicSpot->Update();
|
|
|
+ // rsdindanjd->MoveNext();//不需要下一条,由上层函数控制;
|
|
|
+ rsScenicSpot->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d,%s =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, varClassicOrder.bstrVal, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pSubOrderDigital(const int &nSubId, _variant_t & varSubId, _variant_t & varClassicOrder, _variant_t & varPlatinumOrder, _RecordsetPtr rsdindanjd, _RecordsetPtr rsdindan)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // 判断子单是否存在;
|
|
|
+ CString strSql;
|
|
|
+ strSql.Format(_T("select * from tb_ErpOrderDigital where Ordv_ViceNumber = '%s'"), varSubId.bstrVal);
|
|
|
+ _RecordsetPtr result = c2pQueryExspcits(strSql, m_pPlatinumConnection);
|
|
|
+
|
|
|
+ if (result == NULL || result->adoEOF == VARIANT_TRUE)
|
|
|
+ {
|
|
|
+ // 不存在;
|
|
|
+ if (rsdindanjd->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ _RecordsetPtr rs;
|
|
|
+ rs.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = rs->Open(_T("select * from tb_ErpOrderDigital"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ rs->AddNew();
|
|
|
+ rs->PutCollect(_T("Ordv_Number"), varPlatinumOrder);
|
|
|
+ rs->PutCollect(_T("Ordv_ViceNumber"), varSubId);
|
|
|
+ rs->PutCollect(_T("Ordv_DigitalNumber"), nSubId);
|
|
|
+ rs->PutCollect(_T("Ordv_ClothingStatus"), [&, this]()->_variant_t {
|
|
|
+ // 服装套数;
|
|
|
+ _variant_t var = rsdindan->GetCollect(_T("clothescount"));
|
|
|
+
|
|
|
+ if (var.vt == VT_NULL || _tcscmp(var.bstrVal, _T("")) == 0)
|
|
|
+ {
|
|
|
+ var.vt = VT_I4;
|
|
|
+ var.intVal = 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var.vt = VT_I4;
|
|
|
+ var.intVal = 1;
|
|
|
+ }
|
|
|
+ return var;
|
|
|
+ }());
|
|
|
+ // 初修师;
|
|
|
+ rs->PutCollect(_T("Ordv_EarlyRepairName"), c2pGetEmployeeId(rsdindan->GetCollect(_T("waiter5"))));
|
|
|
+ //rs->PutCollect(_T("Ordv_EarlyRepairTime"), VARDATENULL(pcRecordSet->GetCollect(_T("time8"))));
|
|
|
+ DATENULL(rs, _T("Ordv_EarlyRepairTime"), rsdindan->GetCollect(_T("time8")));
|
|
|
+ rs->PutCollect(_T("Ordv_EarlyRepairStatus"), [&, this]()->_variant_t {
|
|
|
+ _variant_t var = rsdindan->GetCollect(_T("status4"));
|
|
|
+
|
|
|
+ if (var.vt == VT_NULL || _tcscmp(var.bstrVal, _T("")) == 0 || _tcscmp(var.bstrVal, _T("未修")) == 0)
|
|
|
+ return 0;
|
|
|
+ else if (_tcscmp(var.bstrVal, _T("修片中")) == 0)
|
|
|
+ return 1;
|
|
|
+ else
|
|
|
+ return 2;
|
|
|
+ }());
|
|
|
+ // 选片;
|
|
|
+ rs->PutCollect(_T("Ordv_FilmSelectionName"), c2pGetEmployeeId(rsdindan->GetCollect(_T("waiter3"))));
|
|
|
+ //rs->PutCollect(_T("Ordv_FilmSelectionTime"), VARDATENULL(pcRecordSet->GetCollect(_T("time4"))));
|
|
|
+ DATENULL2(rs, _T("Ordv_FilmSelectionTime"), rsdindan->GetCollect(_T("time4")));
|
|
|
+ rs->PutCollect(_T("Ordv_FilmSelectionStatus"), [&, this]()->_variant_t {
|
|
|
+ _variant_t var = rsdindan->GetCollect(_T("status2"));
|
|
|
+
|
|
|
+ if (var.vt == VT_NULL || _tcscmp(var.bstrVal, _T("")) == 0 || _tcscmp(var.bstrVal, _T("未选")) == 0)
|
|
|
+ {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ { // if (_tcscmp(var.bstrVal, _T("OK")) == 0)
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ }());
|
|
|
+ // 设计;
|
|
|
+ rs->PutCollect(_T("Ordv_DesignerName"), c2pGetEmployeeId(rsdindan->GetCollect(_T("waiter4"))));
|
|
|
+ //rs->PutCollect(_T("Ordv_DesignerTime"), VARDATENULL(pcRecordSet->GetCollect(_T("time10"))));
|
|
|
+ DATENULL(rs, _T("Ordv_DesignerTime"), rsdindan->GetCollect(_T("time10")));
|
|
|
+ rs->PutCollect(_T("Ordv_DesignerStatus"), [&, this]()->_variant_t {
|
|
|
+ _variant_t var = rsdindan->GetCollect(_T("status5"));
|
|
|
+
|
|
|
+ if (var.vt == VT_NULL || _tcscmp(var.bstrVal, _T("")) == 0 || _tcscmp(var.bstrVal, _T("未设计")) == 0)
|
|
|
+ {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ else if (_tcscmp(var.bstrVal, _T("设计中")) == 0)
|
|
|
+ {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ { // if (_tcscmp(var.bstrVal, _T("OK")) == 0)
|
|
|
+ return 2;
|
|
|
+ }
|
|
|
+ }());
|
|
|
+ // 精修师;
|
|
|
+ rs->PutCollect(_T("Ordv_RefinementName"), c2pGetEmployeeId(rsdindan->GetCollect(_T("waiter7"))));
|
|
|
+ //rs->PutCollect(_T("Ordv_RefinementTime"), VARDATENULL(pcRecordSet->GetCollect(_T("time9"))));
|
|
|
+ DATENULL(rs, _T("Ordv_RefinementTime"), rsdindan->GetCollect(_T("time9")));
|
|
|
+ rs->PutCollect(_T("Ordv_RefinementStatus"), [&, this]()->_variant_t {
|
|
|
+ _variant_t var = rsdindan->GetCollect(_T("status6"));
|
|
|
+
|
|
|
+ if (var.vt == VT_NULL || _tcscmp(var.bstrVal, _T("")) == 0 || _tcscmp(var.bstrVal, _T("未修")) == 0)
|
|
|
+ {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ else if (_tcscmp(var.bstrVal, _T("修片中")) == 0)
|
|
|
+ {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ { //if (_tcscmp(var.bstrVal, _T("OK")) == 0)
|
|
|
+ return 2;
|
|
|
+ }
|
|
|
+ }());
|
|
|
+ // 看设计;
|
|
|
+ rs->PutCollect(_T("Ordv_LookDesignName"), c2pGetEmployeeId(rsdindan->GetCollect(_T("waiter8"))));
|
|
|
+ //rs->PutCollect(_T("Ordv_LookDesignTime"), VARDATENULL(pcRecordSet->GetCollect(_T("time6"))));
|
|
|
+ DATENULL2(rs, _T("Ordv_LookDesignTime"), rsdindan->GetCollect(_T("time6")));
|
|
|
+ rs->PutCollect(_T("Ordv_LookDesignClaim"), rsdindan->GetCollect(_T("bz2")));
|
|
|
+ rs->PutCollect(_T("Ordv_LookDesignStatus"), [&, this]()->_variant_t {
|
|
|
+ _variant_t var = rsdindan->GetCollect(_T("status8"));
|
|
|
+
|
|
|
+ if (var.vt == VT_NULL || _tcscmp(var.bstrVal, _T("")) == 0 || _tcscmp(var.bstrVal, _T("未看")) == 0)
|
|
|
+ {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ else if (_tcscmp(var.bstrVal, _T("修改中")) == 0)
|
|
|
+ {
|
|
|
+ return 3;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ { // if (_tcscmp(var.bstrVal, _T("OK")) == 0)
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ }());
|
|
|
+ // 入底加挑张数;choosezs;(不做入册加挑)
|
|
|
+ rs->PutCollect(_T("Ordv_IntoBottomAddPickQuantity"), [&, this]()->_variant_t {
|
|
|
+ _variant_t var = rsdindan->GetCollect(_T("choosezs"));
|
|
|
+
|
|
|
+ if (var.vt == VT_NULL || _tcscmp(var.bstrVal, _T("")) == 0)
|
|
|
+ {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ return _ttoi(var.bstrVal);
|
|
|
+ }());
|
|
|
+ // 入底\入册;
|
|
|
+ [&, this]() {
|
|
|
+ CString str = rsdindan->GetCollect(_T("taoxizs")).bstrVal;
|
|
|
+ int nAlbum = -1; // 入册数量,默认-1表示全送;
|
|
|
+ int nNegative = -1;// 入底数量,默认-1表示全送;
|
|
|
+ int nIndex = str.Find(_T("\\"));
|
|
|
+
|
|
|
+ if (nIndex == -1)
|
|
|
+ return;
|
|
|
+
|
|
|
+ // 入底;
|
|
|
+ bool bDigit = true;
|
|
|
+
|
|
|
+ // 使用isdigit会出错,宽字符下;
|
|
|
+ if (!str.Left(nIndex).SpanIncluding(_T("0123456789")))
|
|
|
+ {
|
|
|
+ bDigit = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (bDigit)
|
|
|
+ nNegative = _ttoi(str.Left(nIndex));
|
|
|
+
|
|
|
+ rs->PutCollect(_T("Ordv_IntoBottomQuantity"), nNegative);
|
|
|
+
|
|
|
+ // 入册;
|
|
|
+ bDigit = true;
|
|
|
+
|
|
|
+ // 使用isdigit会出错,宽字符下;
|
|
|
+ if (!str.Mid(nIndex + 1).SpanIncluding(_T("0123456789")))
|
|
|
+ {
|
|
|
+ bDigit = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (bDigit)
|
|
|
+ nAlbum = _ttoi(str.Mid(nIndex + 1));
|
|
|
+
|
|
|
+ rs->PutCollect(_T("Ordv_IntoRegisterQuantity"), nAlbum);
|
|
|
+
|
|
|
+ }();
|
|
|
+
|
|
|
+ // 预约选片人员和选片时间;
|
|
|
+ rs->PutCollect(_T("Ordv_ReservationFilmSelectionDividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ rs->PutCollect(_T("Ordv_ReservationFilmSelectionName"), c2pGetEmployeeId(rsdindan->GetCollect(_T("waiter3"))));
|
|
|
+ rs->PutCollect(_T("Ordv_ReservationFilmSelectionTime"), [&, this]()->_variant_t {
|
|
|
+ _variant_t result;
|
|
|
+ _variant_t date = rsdindan->GetCollect(_T("time4"));
|
|
|
+ _variant_t time = rsdindan->GetCollect(_T("datetime4"));
|
|
|
+
|
|
|
+ if (date.vt != VT_EMPTY && date.vt != VT_NULL && _tcscmp(date.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ CString strdate;
|
|
|
+
|
|
|
+ if (time.vt != VT_EMPTY && time.vt != VT_NULL)
|
|
|
+ {
|
|
|
+ strdate.Format(_T("%s %s"), date.bstrVal, time.bstrVal);
|
|
|
+
|
|
|
+ // time可能包含中文字符;
|
|
|
+ if (strdate.SpanIncluding(_T("0123456789:")))
|
|
|
+ strdate.Format(_T("%s"), date.bstrVal);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ strdate.Format(_T("%s"), date.bstrVal);
|
|
|
+ }
|
|
|
+
|
|
|
+ DATE dt = String2Date(strdate);
|
|
|
+
|
|
|
+ if (dt > 0) //1899年;
|
|
|
+ result = dt;
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }());
|
|
|
+
|
|
|
+ // 预约看样人员和看样时间;
|
|
|
+ rs->PutCollect(_T("Ordv_ReservationLookDesignDividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ rs->PutCollect(_T("Ordv_ReservationLookDesignName"), c2pGetEmployeeId(rsdindan->GetCollect(_T("waiter8"))));
|
|
|
+ rs->PutCollect(_T("Ordv_ReservationLookDesignTime"), [&, this]()->_variant_t {
|
|
|
+ _variant_t result;
|
|
|
+ _variant_t date = rsdindan->GetCollect(_T("time6"));
|
|
|
+ _variant_t time = rsdindan->GetCollect(_T("datetime6"));
|
|
|
+
|
|
|
+ if (date.vt != VT_EMPTY && date.vt != VT_NULL && _tcscmp(date.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ CString strdate;
|
|
|
+
|
|
|
+ if (time.vt != VT_EMPTY && time.vt != VT_NULL)
|
|
|
+ {
|
|
|
+ strdate.Format(_T("%s %s"), date.bstrVal, time.bstrVal);
|
|
|
+
|
|
|
+ // time可能包含中文字符;
|
|
|
+ if (strdate.SpanIncluding(_T("0123456789:")))
|
|
|
+ strdate.Format(_T("%s"), date.bstrVal);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ strdate.Format(_T("%s"), date.bstrVal);
|
|
|
+ }
|
|
|
+
|
|
|
+ DATE dt = String2Date(strdate);
|
|
|
+
|
|
|
+ if (dt > 0) //1899年;
|
|
|
+ result = dt;
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }());
|
|
|
+
|
|
|
+ rs->Update();
|
|
|
+ rs->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pSubOrderDigitalStatus(const int &nSubId, _variant_t & varSubId, _variant_t & varClassicOrder, _variant_t & varPlatinumOrder, _RecordsetPtr rsdindanjd, _RecordsetPtr rsdindan)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // 判断子单是否存在;
|
|
|
+ CString strSql;
|
|
|
+ strSql.Format(_T("select * from tb_ErpOrderDigitalStatus where Ords_ViceNumber = '%s'"), varSubId.bstrVal);
|
|
|
+ _RecordsetPtr result = c2pQueryExspcits(strSql, m_pPlatinumConnection);
|
|
|
+
|
|
|
+ if (result == NULL || result->adoEOF == VARIANT_TRUE)
|
|
|
+ {
|
|
|
+ // 不存在;
|
|
|
+ if (rsdindanjd->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ _RecordsetPtr rs;
|
|
|
+ rs.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = rs->Open(_T("select * from tb_ErpOrderDigitalStatus"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ rs->AddNew();
|
|
|
+ rs->PutCollect(_T("Ords_Number"), [&, this]()->_variant_t {
|
|
|
+ // 如果存在, 或者异常,新建spid;
|
|
|
+ TCHAR szUid[50] = { 0 };
|
|
|
+ TCHAR szResult[50] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 50, 10);
|
|
|
+ _stprintf_s(szResult, _T("ORDS_%s"), &szUid);
|
|
|
+ return szResult;
|
|
|
+ }());
|
|
|
+ rs->PutCollect(_T("Ords_OrdNumber"), varPlatinumOrder);
|
|
|
+ rs->PutCollect(_T("Ords_ViceNumber"), varSubId);
|
|
|
+ rs->PutCollect(_T("Ords_DigitalNumber"), nSubId);
|
|
|
+ rs->PutCollect(_T("Ords_OutSendEarlyRepairStatus"), _T("未发"));//外发初修;
|
|
|
+ rs->PutCollect(_T("Ords_OutSendEarlyRepairQuantity"), 0);
|
|
|
+ //数码拍照状态;
|
|
|
+ rs->PutCollect(_T("Ords_PhotographStatus"), rsdindan->GetCollect(_T("status")));//_T("未拍"));
|
|
|
+ rs->PutCollect(_T("Ords_PhotographIntStatus"), [&, this]()->_variant_t {
|
|
|
+ _variant_t var = rsdindan->GetCollect(_T("status"));
|
|
|
+
|
|
|
+ if (var.vt == VT_NULL || _tcscmp(var.bstrVal, _T("")) == 0 || _tcscmp(var.bstrVal, _T("未拍")) == 0)
|
|
|
+ return 0;
|
|
|
+ else if (_tcscmp(var.bstrVal, _T("OK")) == 0)
|
|
|
+ return 2;
|
|
|
+ else
|
|
|
+ return 1;
|
|
|
+ }());
|
|
|
+ rs->PutCollect(_T("Ords_ProductCount"), 0);
|
|
|
+ rs->PutCollect(_T("Ords_ProductSendStatus"), _T("未发"));
|
|
|
+ rs->PutCollect(_T("Ords_ProductCompletedStatus"), _T("未完"));
|
|
|
+ rs->PutCollect(_T("Ords_ProductPickupStatus"), _T("未取"));
|
|
|
+ rs->PutCollect(_T("Ords_ProductPickupIntStatus"), 0);
|
|
|
+ rs->PutCollect(_T("Ords_ProductIsExpedited"), _T("否"));//是否加急;
|
|
|
+ rs->PutCollect(_T("Ords_ServiceCount"), 0);//数码服务数量
|
|
|
+ rs->PutCollect(_T("Ords_ServiceStatus"), _T("未进行"));//数码服务状态 未进行、已完(OK)、进行中
|
|
|
+ rs->PutCollect(_T("Ords_ServiceIntStatus"), 0);//数码服务状态 0:未进行、1:进行中、2:OK
|
|
|
+ rs->PutCollect(_T("Ords_OutSendRefineRepairStatus"), _T("未发"));//外发精修状态 未发、已发、已回
|
|
|
+ rs->PutCollect(_T("Ords_OutSendRefineRepairQuantity"), 0);//外发精修数量
|
|
|
+
|
|
|
+ rs->Update();
|
|
|
+ rs->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d,%s =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, varClassicOrder.bstrVal, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pSubOrderGoods(_variant_t & varSubId, _variant_t & varClassicOrder, _variant_t & varPlatinumOrder, _RecordsetPtr rsdindanjd, _RecordsetPtr rsdindan)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // 判断子单是否存在;
|
|
|
+ CString strSql;
|
|
|
+ strSql.Format(_T("select * from tb_ErpOrderProductList where OPlist_ViceNumber = '%s' "), varSubId.bstrVal);
|
|
|
+ _RecordsetPtr result = c2pQueryExspcits(strSql, m_pPlatinumConnection);
|
|
|
+
|
|
|
+ if (result == NULL || result->adoEOF == VARIANT_TRUE)
|
|
|
+ {
|
|
|
+ // 不存在;
|
|
|
+ if (rsdindanjd->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d,%s =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, varClassicOrder.bstrVal, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pSubOrderReceiptsRecord(_variant_t & varSubId, _variant_t & varClassicOrder, _variant_t & varPlatinumOrder, _RecordsetPtr rsdindanjd, _RecordsetPtr rsdindan)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // 判断子单是否存在;
|
|
|
+ CString strSql;
|
|
|
+ strSql.Format(_T("select * from tb_ErpOrderProductList where OPlist_ViceNumber = '%s' "), varSubId.bstrVal);
|
|
|
+ _RecordsetPtr result = c2pQueryExspcits(strSql, m_pPlatinumConnection);
|
|
|
+
|
|
|
+ if (result == NULL || result->adoEOF == VARIANT_TRUE)
|
|
|
+ {
|
|
|
+ // 不存在;
|
|
|
+ if (rsdindanjd->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d,%s =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, varClassicOrder.bstrVal, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pSubOrderReceiptsItem(_variant_t & varSubId, _variant_t & varClassicOrder, _variant_t & varPlatinumOrder, _RecordsetPtr rsdindanjd, _RecordsetPtr rsdindan)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // 判断子单是否存在;
|
|
|
+ CString strSql;
|
|
|
+ strSql.Format(_T("select * from tb_ErpOrderProductList where OPlist_ViceNumber = '%s' "), varSubId.bstrVal);
|
|
|
+ _RecordsetPtr result = c2pQueryExspcits(strSql, m_pPlatinumConnection);
|
|
|
+
|
|
|
+ if (result == NULL || result->adoEOF == VARIANT_TRUE)
|
|
|
+ {
|
|
|
+ // 不存在;
|
|
|
+ if (rsdindanjd->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d,%s =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, varClassicOrder.bstrVal, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pGetMultipleShareDir()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // 加入本地目录//不处理备份;
|
|
|
+ {
|
|
|
+ auto ADDLOCALSHAREHOST = [&, this](TCHAR * szDirectory, int nImgType) {
|
|
|
+ bool bhas = false;
|
|
|
+
|
|
|
+ for (ShareDir item : m_vtShareDir)
|
|
|
+ {
|
|
|
+ if (item.strBranchId.IsEmpty() && nImgType == item.photoType && item.strSharePath.CompareNoCase(szDirectory) == 0)
|
|
|
+ {
|
|
|
+ bhas = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bhas)
|
|
|
+ {
|
|
|
+ ShareDir sd;
|
|
|
+ sd.enable = true;
|
|
|
+ sd.photoType = nImgType;
|
|
|
+ sd.strBranchId = _T("");
|
|
|
+ sd.strSharePath = szDirectory;
|
|
|
+ m_vtShareDir.push_back(sd);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ TCHAR szShareDir[MAX_PATH] = { 0 };
|
|
|
+ _stprintf_s(szShareDir, _T("\\\\%s\\%s"), Global::g_szShareImgHost, OImgpath);
|
|
|
+ ADDLOCALSHAREHOST(szShareDir, OImgtype);
|
|
|
+
|
|
|
+ _stprintf_s(szShareDir, _T("\\\\%s\\%s"), Global::g_szShareImgHost, EImgpath);
|
|
|
+ ADDLOCALSHAREHOST(szShareDir, EImgtype);
|
|
|
+
|
|
|
+ _stprintf_s(szShareDir, _T("\\\\%s\\%s"), Global::g_szShareImgHost, FImgpath);
|
|
|
+ ADDLOCALSHAREHOST(szShareDir, FImgtype);
|
|
|
+
|
|
|
+ _stprintf_s(szShareDir, _T("\\\\%s\\%s"), Global::g_szShareImgHost, DImgpath);
|
|
|
+ ADDLOCALSHAREHOST(szShareDir, DImgtype);
|
|
|
+ }
|
|
|
+
|
|
|
+ CString strSql;
|
|
|
+ _RecordsetPtr rsShareInfo;
|
|
|
+ rsShareInfo.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = rsShareInfo->Open(_T("select * from [NetShareInfo]"), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ while (rsShareInfo->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ ShareDir sd;
|
|
|
+ sd.enable = rsShareInfo->GetCollect(_T("enable")).boolVal;
|
|
|
+ sd.strBranchId = rsShareInfo->GetCollect(_T("branchid")).bstrVal;
|
|
|
+ sd.strSharePath = rsShareInfo->GetCollect(_T("sharePath")).bstrVal;
|
|
|
+ sd.photoType = rsShareInfo->GetCollect(_T("photoType")).intVal;
|
|
|
+ bool bexists = false;
|
|
|
+
|
|
|
+ for (ShareDir item : m_vtShareDir)
|
|
|
+ {
|
|
|
+ if (item.photoType == sd.photoType && item.strSharePath.CompareNoCase(sd.strSharePath) == 0)
|
|
|
+ {
|
|
|
+ bexists = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bexists)
|
|
|
+ {
|
|
|
+ m_vtShareDir.push_back(sd);
|
|
|
+ WriteTextLog(sd.strSharePath);
|
|
|
+ }
|
|
|
+
|
|
|
+ rsShareInfo->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsShareInfo->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pGetClassicDomain()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ CString strSql;
|
|
|
+ _RecordsetPtr rspath;
|
|
|
+ rspath.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = rspath->Open(_T("select * from [path]"), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ if (rspath->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ m_strClassicDomain = rspath->GetCollect(_T("path1")).bstrVal;
|
|
|
+ }
|
|
|
+
|
|
|
+ rspath->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pBranchInfo()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ CString strSql;
|
|
|
+ _RecordsetPtr rsVersion;
|
|
|
+ rsVersion.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = rsVersion->Open(_T("select * from version"), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ if (rsVersion->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ // 店面信息;
|
|
|
+ {
|
|
|
+ // 声明记录集指针;
|
|
|
+ _RecordsetPtr pRecordset;
|
|
|
+ // 创建实例;
|
|
|
+ pRecordset.CreateInstance(__uuidof(Recordset));
|
|
|
+ strSql.Format(_T("select * from tb_ErpCompanyInfo where Company_DividedShop = '%s'"), Global::g_szPlatinumBranchId);
|
|
|
+ HRESULT hr = pRecordset->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ if (pRecordset->adoEOF == VARIANT_TRUE)
|
|
|
+ {
|
|
|
+ // 没有记录;
|
|
|
+ pRecordset->AddNew();
|
|
|
+ }
|
|
|
+
|
|
|
+ pRecordset->PutCollect(_T("Company_DividedShop"), _variant_t(Global::g_szPlatinumBranchId));
|
|
|
+ pRecordset->PutCollect(_T("Company_Name"), rsVersion->GetCollect(_T("info1")));
|
|
|
+ pRecordset->PutCollect(_T("Company_Telephone"), rsVersion->GetCollect(_T("info2")));
|
|
|
+ pRecordset->PutCollect(_T("Company_Address"), rsVersion->GetCollect(_T("info3")));
|
|
|
+ pRecordset->PutCollect(_T("Company_URL"), rsVersion->GetCollect(_T("info4")));
|
|
|
+ pRecordset->PutCollect(_T("Company_Manager"), rsVersion->GetCollect(_T("info5")));
|
|
|
+ pRecordset->PutCollect(_T("Company_SingleTitle"), rsVersion->GetCollect(_T("info6")));
|
|
|
+ pRecordset->PutCollect(_T("Company_SingleExplanation"), rsVersion->GetCollect(_T("info7")));
|
|
|
+ pRecordset->PutCollect(_T("Company_DressDescription"), rsVersion->GetCollect(_T("info8")));
|
|
|
+ pRecordset->PutCollect(_T("Company_ProductionNotes"), rsVersion->GetCollect(_T("info9")));
|
|
|
+ pRecordset->PutCollect(_T("Company_ReservationExplanation"), rsVersion->GetCollect(_T("remarks")));
|
|
|
+ pRecordset->PutCollect(_T("Company_ChildReserveExplain"), rsVersion->GetCollect(_T("remarks")));
|
|
|
+ pRecordset->PutCollect(_T("Company_PortraitReserveExplain"), rsVersion->GetCollect(_T("remarks")));
|
|
|
+ pRecordset->PutCollect(_T("Company_MicroShareAccount"), rsVersion->GetCollect(_T("msAccount")));
|
|
|
+ pRecordset->PutCollect(_T("Company_MicroSharePassword"), rsVersion->GetCollect(_T("msPassword")));
|
|
|
+ pRecordset->Update();
|
|
|
+
|
|
|
+ pRecordset->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 短信信息;
|
|
|
+ {
|
|
|
+ // 声明记录集指针;
|
|
|
+ _RecordsetPtr pRecordset;
|
|
|
+ // 创建实例;
|
|
|
+ pRecordset.CreateInstance(__uuidof(Recordset));
|
|
|
+ strSql.Format(_T("select * from tb_ErpSmsAccountInfo where Smsa_DividedShop = '%s'"), Global::g_szPlatinumBranchId);
|
|
|
+ HRESULT hr = pRecordset->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ if (pRecordset->adoEOF == VARIANT_TRUE)
|
|
|
+ {
|
|
|
+ // 没有记录;
|
|
|
+ pRecordset->AddNew();
|
|
|
+ }
|
|
|
+
|
|
|
+ pRecordset->PutCollect(_T("Smsa_AccountNumber"), rsVersion->GetCollect(_T("msgaccount")));
|
|
|
+ pRecordset->PutCollect(_T("Smsa_Password"), rsVersion->GetCollect(_T("msgpsw")));
|
|
|
+ pRecordset->PutCollect(_T("Smsa_DividedShop"), _variant_t(Global::g_szPlatinumBranchId));
|
|
|
+ pRecordset->Update();
|
|
|
+ pRecordset->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pDepartment()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // 声明记录集指针;
|
|
|
+ _RecordsetPtr ptrClassic;
|
|
|
+ _RecordsetPtr ptrPlatinum;
|
|
|
+ // 创建实例;
|
|
|
+ ptrClassic.CreateInstance(__uuidof(Recordset));
|
|
|
+ ptrPlatinum.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = ptrClassic->Open(_T("select * from bumen"), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ hr = ptrPlatinum->Open(_T("select * from tb_ErpDepartment"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ bool bExsits = false;
|
|
|
+
|
|
|
+ while (ptrClassic->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ // 获取部门名称 ;
|
|
|
+ _variant_t varName = ptrClassic->GetCollect(_T("name"));
|
|
|
+ // 判断部门是否存在;
|
|
|
+ bExsits = false;
|
|
|
+
|
|
|
+ while (ptrPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ _variant_t var = ptrPlatinum->GetCollect(_T("Dt_Name"));
|
|
|
+
|
|
|
+ if (_tcscmp(varName.bstrVal, var.bstrVal) == 0)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits)
|
|
|
+ {
|
|
|
+ ptrPlatinum->AddNew();
|
|
|
+ ptrPlatinum->PutCollect(_T("Dt_Name"), varName);
|
|
|
+ ptrPlatinum->PutCollect(_T("Dt_ClassParentID"), 0);
|
|
|
+ ptrPlatinum->PutCollect(_T("Dt_DividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ ptrPlatinum->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->MoveFirst();
|
|
|
+ ptrClassic->MoveNext();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrClassic->Close();
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pEmployee()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ m_dwIndex = 0;
|
|
|
+ // 声明记录集指针;
|
|
|
+ _RecordsetPtr ptrClassic;
|
|
|
+ _RecordsetPtr ptrPlatinum;
|
|
|
+ // 创建实例;
|
|
|
+ ptrClassic.CreateInstance(__uuidof(Recordset));
|
|
|
+ ptrPlatinum.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = ptrClassic->Open(_T("select * from renyuan"), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ hr = ptrPlatinum->Open(_T("select * from tb_ErpUser"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ struct Dept
|
|
|
+ {
|
|
|
+ int nId;
|
|
|
+ CString strName;
|
|
|
+ };
|
|
|
+
|
|
|
+ std::vector<Dept> vtDept;
|
|
|
+ {
|
|
|
+ // 获取部门信息;
|
|
|
+ _RecordsetPtr ptrPlatinum2;
|
|
|
+ ptrPlatinum2.CreateInstance(__uuidof(Recordset));
|
|
|
+ hr = ptrPlatinum2->Open(_T("select * from tb_ErpDepartment"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ while (ptrPlatinum2->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ Dept dept;
|
|
|
+ dept.nId = ptrPlatinum2->GetCollect(_T("ID"));
|
|
|
+ dept.strName = ptrPlatinum2->GetCollect(_T("Dt_Name"));
|
|
|
+ vtDept.push_back(dept);
|
|
|
+ ptrPlatinum2->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum2->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ bool bExsits = false;
|
|
|
+
|
|
|
+ while (ptrClassic->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ m_dwIndex++;
|
|
|
+#ifdef _DEBUG
|
|
|
+
|
|
|
+ if (m_dwIndex == 11)
|
|
|
+ {
|
|
|
+ WriteTextLog(_T("c2pEmployee"));
|
|
|
+ }
|
|
|
+
|
|
|
+#endif
|
|
|
+ // 获取员工名称 ;
|
|
|
+ _variant_t varName = ptrClassic->GetCollect(_T("name"));
|
|
|
+ _variant_t varPhone = ptrClassic->GetCollect(_T("phone"));
|
|
|
+ _variant_t varIdNo = ptrClassic->GetCollect(_T("idno"));
|
|
|
+ // 判断员工是否存在;
|
|
|
+ bExsits = false;
|
|
|
+ bool bSameName = false; // 账号是否相同;
|
|
|
+
|
|
|
+ while (ptrPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ _variant_t varUserName = ptrPlatinum->GetCollect(_T("User_Name"));
|
|
|
+ _variant_t varAccount = ptrPlatinum->GetCollect(_T("User_Account"));
|
|
|
+ _variant_t varTelphone = ptrPlatinum->GetCollect(_T("User_Telephone"));
|
|
|
+ _variant_t varIdCard = ptrPlatinum->GetCollect(_T("User_IdentityCardID"));
|
|
|
+
|
|
|
+ if (_tcscmp(varName.bstrVal, varAccount.bstrVal) == 0)
|
|
|
+ {
|
|
|
+ // 再判断手机号是否相同;//身份证不判断,因为铂金是后来加上的,可以空;
|
|
|
+ if (varTelphone.vt != VT_EMPTY && varTelphone.vt != VT_NULL && _tcscmp(varTelphone.bstrVal, varPhone.bstrVal) == 0)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ bSameName = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits)
|
|
|
+ {
|
|
|
+ _variant_t var;
|
|
|
+ ptrPlatinum->AddNew();
|
|
|
+
|
|
|
+ if (bSameName)
|
|
|
+ {
|
|
|
+ // 同名账号,不同人;
|
|
|
+ ptrPlatinum->PutCollect(_T("User_Account"), [&, this]()->_variant_t {
|
|
|
+ TCHAR szUid[20] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 20, 10);
|
|
|
+ return szUid;
|
|
|
+ }());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ptrPlatinum->PutCollect(_T("User_Account"), ptrClassic->GetCollect(_T("name")));
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->PutCollect(_T("User_Name"), ptrClassic->GetCollect(_T("name")));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_Sex"), ptrClassic->GetCollect(_T("sex")));
|
|
|
+ // 经典版电话长度50, 铂金20;只截取11位长度;
|
|
|
+ var = ptrClassic->GetCollect(_T("phone"));
|
|
|
+
|
|
|
+ if (var.vt == VT_NULL || var.vt == VT_EMPTY || _tcscmp(var.bstrVal, _T("")) == 0)
|
|
|
+ ptrPlatinum->PutCollect(_T("User_Telephone"), _T(""));
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CString strTel = var.bstrVal;
|
|
|
+ ptrPlatinum->PutCollect(_T("User_Telephone"), _variant_t(strTel.Left(11)));
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->PutCollect(_T("User_Hometown"), ptrClassic->GetCollect(_T("address")));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_HometownAddress"), ptrClassic->GetCollect(_T("address")));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_Remark"), ptrClassic->GetCollect(_T("bz")));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_NowAddress"), ptrClassic->GetCollect(_T("address2")));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_IdentityCardID"), ptrClassic->GetCollect(_T("idno")));
|
|
|
+ var = ptrClassic->GetCollect(_T("marry"));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_IsMarried"), _tcscmp(var.bstrVal, _T("已婚")) == 0 ? true : false);
|
|
|
+ ptrPlatinum->PutCollect(_T("User_Status"), ptrClassic->GetCollect(_T("dimission")));
|
|
|
+ // 经典版指纹可能空;
|
|
|
+ var = ptrClassic->GetCollect(_T("loginno1"));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_FirstFingerprintID"), (var.vt == VT_EMPTY || var.vt == VT_NULL) ? _T("") : var);
|
|
|
+ // 经典版指纹可能空;
|
|
|
+ var = ptrClassic->GetCollect(_T("loginno2"));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_SecondaryFingerprintID"), (var.vt == VT_EMPTY || var.vt == VT_NULL) ? _T("") : var);
|
|
|
+ ptrPlatinum->PutCollect(_T("User_EmployeeID"), m_uniqueid.get_unique_id());
|
|
|
+ // 部门id;
|
|
|
+ int ndptId = -1;
|
|
|
+
|
|
|
+ for (Dept &item : vtDept)
|
|
|
+ {
|
|
|
+ if (item.strName.CompareNoCase(ptrClassic->GetCollect(_T("bm")).bstrVal) == 0)
|
|
|
+ {
|
|
|
+ ndptId = item.nId;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->PutCollect(_T("User_Department"), ndptId);
|
|
|
+ ptrPlatinum->PutCollect(_T("User_DividedShop"), Global::g_szPlatinumBranchId); //##虽不是必填项,但是是查询项;
|
|
|
+ // 其他非空字段;
|
|
|
+ ptrPlatinum->PutCollect(_T("User_Password"), _T("81dc9bdb52d04dc20036dbd8313ed055"));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_Positions"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_BelongRoles"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_Competence"), _T(""));
|
|
|
+ time_t osBinaryTime;
|
|
|
+ time(&osBinaryTime);
|
|
|
+ COleDateTime time1(osBinaryTime);
|
|
|
+ ptrPlatinum->PutCollect(_T("User_OnlineTime"), time1.m_dt);
|
|
|
+ ptrPlatinum->PutCollect(_T("User_IsDisable"), false);
|
|
|
+ ptrPlatinum->PutCollect(_T("User_Ethnic"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_ICQAccount"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_Email"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_MicroSignal"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_Attachment"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_SubordinateList"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_HeadImgePath"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_DocumentPermissions"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_EntryTime"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_ProbationTime"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_TryWages"), 0);
|
|
|
+ ptrPlatinum->PutCollect(_T("User_PositiveTime"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_ReEntryTime"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_Graduated"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_ProfessionalLearning"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_Education"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_DateOfBirth"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_InsuranceCategory"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_EmergencyContactsOne"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_EmergencyContactsTelephoneOne"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_EmergencyContactsTwo"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_EmergencyContactsTelephoneTwo"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_ContractPeriod"), 0);
|
|
|
+ ptrPlatinum->PutCollect(_T("User_PositiveID"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("User_IDNegative"), _T(""));
|
|
|
+
|
|
|
+ ptrPlatinum->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->MoveFirst();
|
|
|
+ ptrClassic->MoveNext();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrClassic->Close();
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d, nIndex=%ld =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, m_dwIndex, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pSupplier()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // 声明记录集指针;
|
|
|
+ _RecordsetPtr ptrClassic;
|
|
|
+ _RecordsetPtr ptrPlatinum;
|
|
|
+ // 创建实例;
|
|
|
+ ptrClassic.CreateInstance(__uuidof(Recordset));
|
|
|
+ ptrPlatinum.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = ptrClassic->Open(_T("select * from gongyingshang"), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ hr = ptrPlatinum->Open(_T("select * from tb_ErpVendor"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ bool bExsits = false;
|
|
|
+
|
|
|
+ while (ptrClassic->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ // 获取名称 ;
|
|
|
+ _variant_t varName = ptrClassic->GetCollect(_T("gyname"));
|
|
|
+ // 判断是否存在;
|
|
|
+ bExsits = false;
|
|
|
+
|
|
|
+ while (ptrPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ _variant_t var = ptrPlatinum->GetCollect(_T("Vd_Name"));
|
|
|
+
|
|
|
+ if (_tcscmp(varName.bstrVal, var.bstrVal) == 0)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits)
|
|
|
+ {
|
|
|
+ ptrPlatinum->AddNew();
|
|
|
+ ptrPlatinum->PutCollect(_T("Vd_Name"), ptrClassic->GetCollect(_T("gyname")));
|
|
|
+ ptrPlatinum->PutCollect(_T("Vd_Address"), ptrClassic->GetCollect(_T("addr")));
|
|
|
+ ptrPlatinum->PutCollect(_T("Vd_Telephone"), ptrClassic->GetCollect(_T("tel")));
|
|
|
+ ptrPlatinum->PutCollect(_T("Vd_Fax"), ptrClassic->GetCollect(_T("fax")));
|
|
|
+ ptrPlatinum->PutCollect(_T("Vd_URL"), ptrClassic->GetCollect(_T("netaddress")));
|
|
|
+ ptrPlatinum->PutCollect(_T("Vd_Remark"), ptrClassic->GetCollect(_T("bz")));
|
|
|
+ ptrPlatinum->PutCollect(_T("Vd_Category"), _T("0"));
|
|
|
+ // ID;
|
|
|
+ ptrPlatinum->PutCollect(_T("Vd_Number"), [&, this]()->_variant_t {
|
|
|
+ // 如果存在, 或者异常,新建spid;
|
|
|
+ TCHAR szUid[24] = { 0 };
|
|
|
+ TCHAR szResult[50] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 24, 10);
|
|
|
+ _stprintf_s(szResult, _T("SPH%s"), &szUid[3]);
|
|
|
+ return szResult;
|
|
|
+ }());
|
|
|
+ ptrPlatinum->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->MoveFirst();
|
|
|
+ ptrClassic->MoveNext();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrClassic->Close();
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pGoodsType()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // 声明记录集指针;
|
|
|
+ _RecordsetPtr ptrClassic;
|
|
|
+ _RecordsetPtr ptrPlatinum;
|
|
|
+ // 创建实例;
|
|
|
+ ptrClassic.CreateInstance(__uuidof(Recordset));
|
|
|
+ ptrPlatinum.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = ptrClassic->Open(_T("select * from shangpinlb"), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ // AAAAAAA;BEBBBCADFEBEJBGD;BEBACCAFFHEAJICDF;BEBACCAFEGECFBJFD
|
|
|
+ hr = ptrPlatinum->Open(_T("select * from tb_ErpSystemCategory"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ // 获取铂金版父类id;
|
|
|
+ int nPlatinumGoodsId = -1;
|
|
|
+ int nServiceGoodsId = -1; // 服务类型id;
|
|
|
+
|
|
|
+ while (ptrPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ _variant_t gid = ptrPlatinum->GetCollect(_T("Sc_ClassCode"));
|
|
|
+
|
|
|
+ if (_tcscmp(_T("AAAAAAA"), gid.bstrVal) == 0)
|
|
|
+ {
|
|
|
+ nPlatinumGoodsId = ptrPlatinum->GetCollect(_T("ID"));
|
|
|
+ }
|
|
|
+
|
|
|
+ _variant_t sid = ptrPlatinum->GetCollect(_T("Sc_ClassCode"));
|
|
|
+
|
|
|
+ if (_tcscmp(_T("BEBADABBEEEGAEGFG"), gid.bstrVal) == 0)
|
|
|
+ {
|
|
|
+ nServiceGoodsId = ptrPlatinum->GetCollect(_T("ID"));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (nPlatinumGoodsId != -1 && nServiceGoodsId != -1)
|
|
|
+ break;
|
|
|
+
|
|
|
+ ptrPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ bool bExsits = false;
|
|
|
+
|
|
|
+ while (ptrClassic->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ // 获取名称 ;
|
|
|
+ _variant_t varName = ptrClassic->GetCollect(_T("name"));
|
|
|
+ // 判断是否存在;
|
|
|
+ bExsits = false;
|
|
|
+
|
|
|
+ while (ptrPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ _variant_t varParentId = ptrPlatinum->GetCollect(_T("Sc_ClassParentID"));
|
|
|
+ _variant_t varClassName = ptrPlatinum->GetCollect(_T("Sc_ClassName"));
|
|
|
+
|
|
|
+ if (_tcscmp(varName.bstrVal, varClassName.bstrVal) == 0 && (varParentId.intVal == nPlatinumGoodsId || varParentId.intVal == nServiceGoodsId))
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits)
|
|
|
+ {
|
|
|
+ ptrPlatinum->AddNew();
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_ClassName"), ptrClassic->GetCollect(_T("name")));
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_ClassCode"), [this]()->_variant_t {
|
|
|
+ TCHAR szUid[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 24, 10);
|
|
|
+
|
|
|
+ for (int i = 0; i < _tcslen(szUid); i++)
|
|
|
+ {
|
|
|
+ szUid[i] += 17;
|
|
|
+ }
|
|
|
+
|
|
|
+ return szUid;
|
|
|
+ }());
|
|
|
+
|
|
|
+ // 其他非空类;
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_IsDisable"), false);
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_IsReadOnly"), false);
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_IsEnabledURL"), false);
|
|
|
+
|
|
|
+ if (_tcscmp(ptrClassic->GetCollect(_T("name")).bstrVal, _T("婚庆服务")) == 0)
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_ClassParentID"), nServiceGoodsId);
|
|
|
+ else
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_ClassParentID"), nPlatinumGoodsId);
|
|
|
+
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_CreateDatetime"), []() ->_variant_t {
|
|
|
+ time_t osBinaryTime;
|
|
|
+ time(&osBinaryTime);
|
|
|
+ COleDateTime time1(osBinaryTime);
|
|
|
+ return time1.m_dt;
|
|
|
+ }());
|
|
|
+ ptrPlatinum->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->MoveFirst();
|
|
|
+ ptrClassic->MoveNext();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrClassic->Close();
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pGoodsInfo()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ m_dwIndex = 0;
|
|
|
+ // 声明记录集指针;
|
|
|
+ _RecordsetPtr ptrClassic;
|
|
|
+ _RecordsetPtr ptrPlatinum;
|
|
|
+ // 创建实例;
|
|
|
+ ptrClassic.CreateInstance(__uuidof(Recordset));
|
|
|
+ ptrPlatinum.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = ptrClassic->Open(_T("select * from shangpin"), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ CString strSql;
|
|
|
+ hr = ptrPlatinum->Open(_T("select * from tb_ErpProduct"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ bool bExsits = false;
|
|
|
+
|
|
|
+ while (ptrClassic->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ // 获取名称 ;
|
|
|
+ _variant_t varName = ptrClassic->GetCollect(_T("spname")); m_strMsg = varName.bstrVal;
|
|
|
+ // 判断是否存在;
|
|
|
+ bExsits = false;
|
|
|
+#ifdef _DEBUG
|
|
|
+
|
|
|
+ if (m_strMsg == _T("12寸欧莱雅相册"))
|
|
|
+ {
|
|
|
+ WriteTextLog(_T("c2pGoodsInfo"));
|
|
|
+ }
|
|
|
+
|
|
|
+#endif
|
|
|
+ while (ptrPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ _variant_t var = ptrPlatinum->GetCollect(_T("Prod_Name"));
|
|
|
+
|
|
|
+ if (_tcscmp(varName.bstrVal, var.bstrVal) == 0)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits)
|
|
|
+ {
|
|
|
+ _variant_t var;
|
|
|
+ ptrPlatinum->AddNew();
|
|
|
+ ptrPlatinum->PutCollect(_T("c2p_spid"), ptrClassic->GetCollect(_T("spid")));
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_DividedShop"), Global::g_szPlatinumBranchId);// 如果存在id存在;
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_Name"), ptrClassic->GetCollect(_T("spname")));
|
|
|
+ var = ptrClassic->GetCollect(_T("spdanwei"));
|
|
|
+
|
|
|
+ if (var.vt == VT_EMPTY || var.vt == VT_NULL || _tcscmp(var.bstrVal, _T("")) == 0)
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_Unit"), _T("Null"));//长度超出铂金,出错;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CString strUnit = var.bstrVal;
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_Unit"), _variant_t(strUnit.Left(10)));//长度超出铂金,出错;
|
|
|
+ }
|
|
|
+
|
|
|
+ //成本价;
|
|
|
+ PRICENULL(ptrPlatinum, _T("Prod_CostPrice"), ptrClassic->GetCollect(_T("spjiaga1")));
|
|
|
+ //卖价;
|
|
|
+ PRICENULL(ptrPlatinum, _T("Prod_SalesPrice"), ptrClassic->GetCollect(_T("spjiage2")));
|
|
|
+ //供应商制作费;
|
|
|
+ PRICENULL(ptrPlatinum, _T("Prod_PurchasePrice"), ptrClassic->GetCollect(_T("spjiage3")));
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_Remark"), ptrClassic->GetCollect(_T("spbz")));
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_Introduction"), ptrClassic->GetCollect(_T("spbz")));
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_Detail"), ptrClassic->GetCollect(_T("spbz")));
|
|
|
+ var = ptrClassic->GetCollect(_T("hide"));
|
|
|
+
|
|
|
+ if (var.vt == VT_EMPTY || var.vt == VT_NULL || _tcscmp(var.bstrVal, _T("")) == 0)
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_IsEnabled"), false);
|
|
|
+ else
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_IsEnabled"), _tcscmp(ptrClassic->GetCollect(_T("hide")).bstrVal, _T("上架")) == 0 ? true : false);
|
|
|
+
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_Width"), ptrClassic->GetCollect(_T("width")));
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_Height"), ptrClassic->GetCollect(_T("height")));
|
|
|
+ // 生成商品ID;
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_Number"), [&, this]()->_variant_t {
|
|
|
+ // 如果存在, 或者异常,新建spid;
|
|
|
+ TCHAR szUid[24] = { 0 };
|
|
|
+ TCHAR szResult[50] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 24, 10);
|
|
|
+ _stprintf_s(szResult, _T("SP%s"), &szUid[2]);
|
|
|
+ return szResult;
|
|
|
+ }());
|
|
|
+
|
|
|
+ // 供应商;//由于经典商品并没有关联供应商,所以无法关联;
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_Vendor"), _T(""));
|
|
|
+
|
|
|
+ // 商品类别和商品类别名称;
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_ClassName"), ptrClassic->GetCollect(_T("splb")));
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_Class"), [&, this](_variant_t splb)->_variant_t {
|
|
|
+ _RecordsetPtr rs;
|
|
|
+ _variant_t varspid = _T("");
|
|
|
+ rs.CreateInstance(__uuidof(Recordset));
|
|
|
+ CString strSql;
|
|
|
+ strSql.Format(_T("select Sc_ClassCode,Sc_ClassName from tb_ErpSystemCategory where Sc_ClassName='%s'"), splb.bstrVal);
|
|
|
+ hr = rs->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenForwardOnly, adLockReadOnly, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ bool bClassCode = false;
|
|
|
+
|
|
|
+ while (rs->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (_tcscmp(splb.bstrVal, rs->GetCollect(_T("Sc_ClassName")).bstrVal) == 0)
|
|
|
+ {
|
|
|
+ bClassCode = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rs->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (bClassCode)
|
|
|
+ {
|
|
|
+ varspid = rs->GetCollect(_T("Sc_ClassCode"));
|
|
|
+ }
|
|
|
+
|
|
|
+ rs->Close();
|
|
|
+
|
|
|
+ return varspid;
|
|
|
+ }
|
|
|
+
|
|
|
+ return _T("");
|
|
|
+ }(ptrClassic->GetCollect(_T("splb"))));
|
|
|
+
|
|
|
+ // 其他非字段;
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_Batch"), 0);
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_AlarmQuantity"), 0);
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_SpecialPrice"), 0);
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_IsRetail"), 0);
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_Thumbnail"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_FullSizeImage"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_Expedited"), 0);
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_CreateDateTime"), []()->_variant_t {
|
|
|
+ time_t osBinaryTime;
|
|
|
+ time(&osBinaryTime);
|
|
|
+ COleDateTime time1(osBinaryTime);
|
|
|
+ return time1.m_dt;
|
|
|
+ }());
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_CreateName"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_UpdateDateTime"), []()->_variant_t {
|
|
|
+ time_t osBinaryTime;
|
|
|
+ time(&osBinaryTime);
|
|
|
+ COleDateTime time1(osBinaryTime);
|
|
|
+ return time1.m_dt;
|
|
|
+ }());
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_SpecialPrice"), 0);
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_Availability"), 0);
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_PrintArea"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("Prod_UpdateName"), _T(""));
|
|
|
+ ptrPlatinum->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->MoveFirst();
|
|
|
+ ptrClassic->MoveNext();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrClassic->Close();
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d,商品名=%s =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, m_strMsg, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pPackageType()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // 声明记录集指针;
|
|
|
+ _RecordsetPtr ptrClassic;
|
|
|
+ _RecordsetPtr ptrPlatinum;
|
|
|
+ // 创建实例;
|
|
|
+ ptrClassic.CreateInstance(__uuidof(Recordset));
|
|
|
+ ptrPlatinum.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = ptrClassic->Open(_T("select * from txlb2"), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ // AAAAAAB;BEBBBCADFEBEJBGD;BEBACCAFFHEAJICDF;BEBACCAFEGECFBJFD
|
|
|
+ hr = ptrPlatinum->Open(_T("select * from tb_ErpSystemCategory"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ // 获取铂金版父类id;
|
|
|
+ int nPlatinumGoodsId = -1;
|
|
|
+
|
|
|
+ while (ptrPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ _variant_t gid = ptrPlatinum->GetCollect(_T("Sc_ClassCode"));
|
|
|
+
|
|
|
+ if (_tcscmp(_T("AAAAAAB"), gid.bstrVal) == 0)
|
|
|
+ {
|
|
|
+ nPlatinumGoodsId = ptrPlatinum->GetCollect(_T("ID"));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ bool bExsits = false;
|
|
|
+
|
|
|
+ while (ptrClassic->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ // 获取名称 ;
|
|
|
+ _variant_t varName = ptrClassic->GetCollect(_T("name"));
|
|
|
+ // 判断是否存在;
|
|
|
+ bExsits = false;
|
|
|
+
|
|
|
+ while (ptrPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ _variant_t varParentId = ptrPlatinum->GetCollect(_T("Sc_ClassParentID"));
|
|
|
+ _variant_t varClassName = ptrPlatinum->GetCollect(_T("Sc_ClassName"));
|
|
|
+
|
|
|
+ if (_tcscmp(varName.bstrVal, varClassName.bstrVal) == 0 && varParentId.intVal == nPlatinumGoodsId)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits)
|
|
|
+ {
|
|
|
+ ptrPlatinum->AddNew();
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_ClassName"), ptrClassic->GetCollect(_T("name")));
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_ClassParentID"), nPlatinumGoodsId);
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_ClassCode"), [this]()->_variant_t {
|
|
|
+ TCHAR szUid[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 24, 10);
|
|
|
+
|
|
|
+ for (int i = 0; i < _tcslen(szUid); i++)
|
|
|
+ {
|
|
|
+ szUid[i] += 17;
|
|
|
+ }
|
|
|
+
|
|
|
+ return szUid;
|
|
|
+ }());
|
|
|
+
|
|
|
+ // 其他非空类;
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_IsDisable"), false);
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_IsReadOnly"), false);
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_IsEnabledURL"), false);
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_CreateDatetime"), []() ->_variant_t {
|
|
|
+ time_t osBinaryTime;
|
|
|
+ time(&osBinaryTime);
|
|
|
+ COleDateTime time1(osBinaryTime);
|
|
|
+ return time1.m_dt;
|
|
|
+ }());
|
|
|
+ ptrPlatinum->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->MoveFirst();
|
|
|
+ ptrClassic->MoveNext();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrClassic->Close();
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pPackageInfo()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // 声明记录集指针;
|
|
|
+ _RecordsetPtr ptrClassic;
|
|
|
+ _RecordsetPtr ptrPlatinum;
|
|
|
+ // 创建实例;
|
|
|
+ ptrClassic.CreateInstance(__uuidof(Recordset));
|
|
|
+ ptrPlatinum.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = ptrClassic->Open(_T("select * from taoxi"), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ hr = ptrPlatinum->Open(_T("select * from tb_ErpPackages"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ bool bExsits = false;
|
|
|
+
|
|
|
+ while (ptrClassic->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ // 获取名称 ;
|
|
|
+ _variant_t varName = ptrClassic->GetCollect(_T("taoxiname")); m_strMsg = varName.bstrVal;
|
|
|
+ // 判断是否存在;
|
|
|
+ bExsits = false;
|
|
|
+
|
|
|
+ while (ptrPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ _variant_t var = ptrPlatinum->GetCollect(_T("Pak_Name"));
|
|
|
+
|
|
|
+ if (_tcscmp(varName.bstrVal, var.bstrVal) == 0)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits)
|
|
|
+ {
|
|
|
+ ptrPlatinum->AddNew();
|
|
|
+ ptrPlatinum->PutCollect(_T("c2p_taoxiid"), ptrClassic->GetCollect(_T("taoxiid")));
|
|
|
+ ptrPlatinum->PutCollect(_T("Pak_DividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ ptrPlatinum->PutCollect(_T("Pak_Name"), ptrClassic->GetCollect(_T("taoxiname")));
|
|
|
+ //ptrPlatinum->PutCollect(_T("Pak_UnitPrice"), PRICENULL(ptrClassic->GetCollect(_T("taoxijiage"))));
|
|
|
+ PRICENULL(ptrPlatinum, _T("Pak_UnitPrice"), ptrClassic->GetCollect(_T("taoxijiage")));
|
|
|
+ ptrPlatinum->PutCollect(_T("Pak_IsDisable"), _tcscmp(ptrClassic->GetCollect(_T("show")).bstrVal, _T("显示")) == 0 ? false : true);
|
|
|
+ ptrPlatinum->PutCollect(_T("Pak_PackagesClassName"), ptrClassic->GetCollect(_T("type")));
|
|
|
+ ptrPlatinum->PutCollect(_T("Pak_PackagesClass"), [&, this](_variant_t txlb)->_variant_t {
|
|
|
+ _RecordsetPtr rs;
|
|
|
+ _variant_t varspid = _T("");
|
|
|
+ rs.CreateInstance(__uuidof(Recordset));
|
|
|
+ CString strSql;
|
|
|
+ strSql.Format(_T("select Sc_ClassCode,Sc_ClassName from tb_ErpSystemCategory where Sc_ClassName='%s'"), txlb.bstrVal);
|
|
|
+ hr = rs->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenForwardOnly, adLockReadOnly, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ bool bClassCode = false;
|
|
|
+
|
|
|
+ while (rs->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (_tcscmp(txlb.bstrVal, rs->GetCollect(_T("Sc_ClassName")).bstrVal) == 0)
|
|
|
+ {
|
|
|
+ bClassCode = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rs->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (bClassCode)
|
|
|
+ {
|
|
|
+ varspid = rs->GetCollect(_T("Sc_ClassCode"));
|
|
|
+ }
|
|
|
+
|
|
|
+ rs->Close();
|
|
|
+
|
|
|
+ return varspid;
|
|
|
+ }
|
|
|
+
|
|
|
+ return _T("");
|
|
|
+ }(ptrClassic->GetCollect(_T("type"))));
|
|
|
+ ptrPlatinum->PutCollect(_T("Pak_OptionalSeveral"), 0);
|
|
|
+ ptrPlatinum->PutCollect(_T("Pak_PackagesMainClass"), _T("AAAAAAB"));//#坑#: 必须填,不然铂金版中显示不出来;
|
|
|
+ // ID;
|
|
|
+ ptrPlatinum->PutCollect(_T("Pak_PackagesID"), [&, this]()->_variant_t {
|
|
|
+ // 如果存在, 或者异常,新建spid;
|
|
|
+ TCHAR szUid[24] = { 0 };
|
|
|
+ TCHAR szResult[50] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 24, 10);
|
|
|
+ _stprintf_s(szResult, _T("TX%s"), &szUid[2]);
|
|
|
+ return szResult;
|
|
|
+ }());
|
|
|
+ // 入底\入册;
|
|
|
+ [&, this]() {
|
|
|
+ CString str = ptrClassic->GetCollect(_T("zs")).bstrVal;
|
|
|
+ int nAlbum = -1; // 入册数量,默认-1表示全送;
|
|
|
+ int nNegative = -1;// 入底数量,默认-1表示全送;
|
|
|
+ int nIndex = str.Find(_T("\\"));
|
|
|
+
|
|
|
+ if (nIndex == -1)
|
|
|
+ return;
|
|
|
+
|
|
|
+ // 入底;
|
|
|
+ bool bDigit = true;
|
|
|
+
|
|
|
+ // 使用isdigit会出错,宽字符下;
|
|
|
+ if (!str.Left(nIndex).SpanIncluding(_T("0123456789")))
|
|
|
+ {
|
|
|
+ bDigit = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (bDigit)
|
|
|
+ nNegative = _ttoi(str.Left(nIndex));
|
|
|
+
|
|
|
+ ptrPlatinum->PutCollect(_T("Pak_IntoTheArchive"), nNegative);
|
|
|
+
|
|
|
+ // 入册;
|
|
|
+ bDigit = true;
|
|
|
+
|
|
|
+ // 使用isdigit会出错,宽字符下;
|
|
|
+ if (!str.Mid(nIndex + 1).SpanIncluding(_T("0123456789")))
|
|
|
+ {
|
|
|
+ bDigit = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (bDigit)
|
|
|
+ nAlbum = _ttoi(str.Mid(nIndex + 1));
|
|
|
+
|
|
|
+ ptrPlatinum->PutCollect(_T("Pak_IntoTheBook"), nAlbum);
|
|
|
+
|
|
|
+ }();
|
|
|
+ ptrPlatinum->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->MoveFirst();
|
|
|
+ ptrClassic->MoveNext();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrClassic->Close();
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d,%s =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, m_strMsg, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pPackageGoods()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // 声明记录集指针;
|
|
|
+ _RecordsetPtr ptrClassic;
|
|
|
+ _RecordsetPtr ptrPlatinum;
|
|
|
+ // 创建实例;
|
|
|
+ ptrClassic.CreateInstance(__uuidof(Recordset));
|
|
|
+ ptrPlatinum.CreateInstance(__uuidof(Recordset));
|
|
|
+ // 被删除的套系和商品不会出现,也就不会被录入,某些订单将不显示商品,原因就是这;
|
|
|
+ HRESULT hr = ptrClassic->Open(_T("SELECT\
|
|
|
+ dbo.taoxishangpin1.id,\
|
|
|
+ dbo.taoxishangpin1.spid1,\
|
|
|
+ dbo.taoxishangpin1.shuliang,\
|
|
|
+ dbo.shangpin.spname,\
|
|
|
+ dbo.shangpin.spjiaga1,\
|
|
|
+ dbo.taoxishangpin1.taoxiid,\
|
|
|
+ dbo.taoxi.taoxiname, \
|
|
|
+ dbo.taoxi.type, \
|
|
|
+ dbo.taoxi.show \
|
|
|
+ FROM dbo.taoxishangpin1 \
|
|
|
+ INNER JOIN dbo.taoxi ON dbo.taoxi.taoxiid = dbo.taoxishangpin1.taoxiid \
|
|
|
+ INNER JOIN dbo.shangpin ON dbo.taoxishangpin1.spid1 = dbo.shangpin.spid"), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ hr = ptrPlatinum->Open(_T("select * from tb_ErpPackagesGiftMerchandise"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ bool bExsits = false;
|
|
|
+
|
|
|
+ while (ptrClassic->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ m_strMsg = ptrClassic->GetCollect(_T("spid1")).bstrVal;
|
|
|
+ // 通过商品名来获取铂金商品ID;
|
|
|
+ _variant_t varPlatinumGoodsId = [&, this](_variant_t varSpName)->_variant_t {
|
|
|
+ CString str;
|
|
|
+ _RecordsetPtr rs;
|
|
|
+ _variant_t varProdNumber;
|
|
|
+ rs.CreateInstance(__uuidof(Recordset));
|
|
|
+ str.Format(_T("select Prod_Number from tb_ErpProduct where Prod_Name = '%s'"), varSpName.bstrVal);
|
|
|
+ hr = rs->Open(_variant_t(str), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenForwardOnly, adLockReadOnly, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ if (rs->adoEOF == VARIANT_FALSE)
|
|
|
+ varProdNumber = rs->GetCollect(_T("Prod_Number"));
|
|
|
+
|
|
|
+ rs->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ return varProdNumber;
|
|
|
+ }(ptrClassic->GetCollect(_T("spname")));
|
|
|
+
|
|
|
+ _variant_t varPlatinumPackageId = _T("");
|
|
|
+ _variant_t varPlatinumPackageName = _T("");
|
|
|
+ _variant_t varPlatinumPackageTypeId = _T("");
|
|
|
+ // 通过套系名和套系类型来获取铂金套系信息;
|
|
|
+ [&, this](_variant_t varPakName, _variant_t varPakClassName) {
|
|
|
+ CString str;
|
|
|
+ _RecordsetPtr rs;
|
|
|
+ rs.CreateInstance(__uuidof(Recordset));
|
|
|
+ str.Format(_T("select Pak_PackagesClass,Pak_Name,Pak_PackagesID from tb_ErpPackages where Pak_Name = '%s' and Pak_PackagesClassName = '%s'"), varPakName.bstrVal, varPakClassName.bstrVal);
|
|
|
+ hr = rs->Open(_variant_t(str), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenForwardOnly, adLockReadOnly, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ if (rs->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ varPlatinumPackageTypeId = rs->GetCollect(_T("Pak_PackagesClass"));
|
|
|
+ varPlatinumPackageName = rs->GetCollect(_T("Pak_Name"));
|
|
|
+ varPlatinumPackageId = rs->GetCollect(_T("Pak_PackagesID"));
|
|
|
+ }
|
|
|
+
|
|
|
+ rs->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ (ptrClassic->GetCollect(_T("taoxiname")), ptrClassic->GetCollect(_T("type")));
|
|
|
+
|
|
|
+ // 判断是否存在;
|
|
|
+ bExsits = false;
|
|
|
+
|
|
|
+ while (ptrPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ // 获取名称 ;
|
|
|
+ _variant_t varPackagesId = ptrPlatinum->GetCollect(_T("Pgm_PackagesCode"));
|
|
|
+ _variant_t varProductId = ptrPlatinum->GetCollect(_T("Pgm_ProductNumber"));
|
|
|
+ _variant_t varGiveType = ptrPlatinum->GetCollect(_T("Pgm_GiveType"));
|
|
|
+
|
|
|
+ if (_tcscmp(varPlatinumGoodsId.bstrVal, varProductId.bstrVal) == 0 && _tcscmp(varPlatinumPackageId.bstrVal, varPackagesId.bstrVal) == 0 && varGiveType.intVal == 0)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果商品不存在,不录入;
|
|
|
+ if (!bExsits && varPlatinumPackageId.vt != VT_EMPTY && varPlatinumPackageId.vt != VT_NULL)
|
|
|
+ {
|
|
|
+ ptrPlatinum->AddNew();
|
|
|
+ ptrPlatinum->PutCollect(_T("Pgm_GiveType"), 0);
|
|
|
+ ptrPlatinum->PutCollect(_T("Pgm_ProductNumber"), varPlatinumGoodsId);
|
|
|
+ ptrPlatinum->PutCollect(_T("Pgm_Quantity"), VARINT(ptrClassic->GetCollect(_T("shuliang"))));// 含有中文;
|
|
|
+ ptrPlatinum->PutCollect(_T("Pgm_PackagesNumber"), varPlatinumPackageTypeId);//套系类型ID;
|
|
|
+ ptrPlatinum->PutCollect(_T("Pgm_PackagesName"), varPlatinumPackageName);
|
|
|
+ ptrPlatinum->PutCollect(_T("Pgm_PackagesCode"), varPlatinumPackageId);
|
|
|
+ ptrPlatinum->PutCollect(_T("Pgm_ProductName"), ptrClassic->GetCollect(_T("spname")));
|
|
|
+ ptrPlatinum->PutCollect(_T("Pgm_IntoRegisterQuantity"), 0);
|
|
|
+ ptrPlatinum->PutCollect(_T("Pgm_IntoBottomQuantity"), 0);
|
|
|
+ ptrPlatinum->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->MoveFirst();
|
|
|
+ ptrClassic->MoveNext();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrClassic->Close();
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d,商品Id=%s, =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, m_strMsg, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pPackageGoods2()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // 声明记录集指针;
|
|
|
+ _RecordsetPtr ptrClassic;
|
|
|
+ _RecordsetPtr ptrPlatinum;
|
|
|
+ // 创建实例;
|
|
|
+ ptrClassic.CreateInstance(__uuidof(Recordset));
|
|
|
+ ptrPlatinum.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = ptrClassic->Open(_T("SELECT\
|
|
|
+ dbo.taoxishangpin2.id,\
|
|
|
+ dbo.taoxishangpin2.spid2,\
|
|
|
+ dbo.taoxishangpin2.shuliang,\
|
|
|
+ dbo.taoxishangpin2.taoxiid,\
|
|
|
+ dbo.shangpin.spname,\
|
|
|
+ dbo.shangpin.spjiaga1,\
|
|
|
+ dbo.taoxi.taoxiname, \
|
|
|
+ dbo.taoxi.type, \
|
|
|
+ dbo.taoxi.show \
|
|
|
+ FROM dbo.taoxishangpin2 \
|
|
|
+ INNER JOIN dbo.taoxi ON dbo.taoxi.taoxiid = dbo.taoxishangpin2.taoxiid \
|
|
|
+ INNER JOIN dbo.shangpin ON dbo.taoxishangpin2.spid2 = dbo.shangpin.spid"), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ hr = ptrPlatinum->Open(_T("select * from tb_ErpPackagesGiftMerchandise"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ bool bExsits = false;
|
|
|
+
|
|
|
+ while (ptrClassic->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ // 根据商品名的铂金商品ID;
|
|
|
+ _variant_t varPlatinumGoodsId = [&, this](_variant_t varSpName)->_variant_t {
|
|
|
+ CString str;
|
|
|
+ _RecordsetPtr rs;
|
|
|
+ _variant_t varProdNumber;
|
|
|
+ m_strMsg = varSpName.bstrVal;
|
|
|
+ rs.CreateInstance(__uuidof(Recordset));
|
|
|
+ str.Format(_T("select Prod_Number from tb_ErpProduct where Prod_Name = '%s'"), varSpName.bstrVal);
|
|
|
+ hr = rs->Open(_variant_t(str), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenForwardOnly, adLockReadOnly, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ if (rs->adoEOF == VARIANT_FALSE)
|
|
|
+ varProdNumber = rs->GetCollect(_T("Prod_Number"));
|
|
|
+
|
|
|
+ rs->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ return varProdNumber;
|
|
|
+ }(ptrClassic->GetCollect(_T("spname")));
|
|
|
+
|
|
|
+ _variant_t varPlatinumPackageId = _T("");
|
|
|
+ _variant_t varPlatinumPackageName = _T("");
|
|
|
+ _variant_t varPlatinumPackageTypeId = _T("");
|
|
|
+ [&, this](_variant_t varPakName, _variant_t varPakClassName) {
|
|
|
+ CString str;
|
|
|
+ _RecordsetPtr rs;
|
|
|
+ rs.CreateInstance(__uuidof(Recordset));
|
|
|
+ str.Format(_T("select Pak_PackagesClass,Pak_Name,Pak_PackagesID from tb_ErpPackages where Pak_Name = '%s' and Pak_PackagesClassName = '%s'"), varPakName.bstrVal, varPakClassName.bstrVal);
|
|
|
+ hr = rs->Open(_variant_t(str), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenForwardOnly, adLockReadOnly, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ if (rs->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ varPlatinumPackageTypeId = rs->GetCollect(_T("Pak_PackagesClass"));
|
|
|
+ varPlatinumPackageName = rs->GetCollect(_T("Pak_Name"));
|
|
|
+ varPlatinumPackageId = rs->GetCollect(_T("Pak_PackagesID"));
|
|
|
+ }
|
|
|
+
|
|
|
+ rs->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ (ptrClassic->GetCollect(_T("taoxiname")), ptrClassic->GetCollect(_T("type")));
|
|
|
+
|
|
|
+ // 判断是否存在;
|
|
|
+ bExsits = false;
|
|
|
+
|
|
|
+ while (ptrPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ // 获取名称 ;
|
|
|
+ _variant_t varPackagesId = ptrPlatinum->GetCollect(_T("Pgm_PackagesCode"));
|
|
|
+ _variant_t varProductId = ptrPlatinum->GetCollect(_T("Pgm_ProductNumber"));
|
|
|
+ _variant_t varGiveType = ptrPlatinum->GetCollect(_T("Pgm_GiveType"));
|
|
|
+
|
|
|
+ if (_tcscmp(varPlatinumGoodsId.bstrVal, varProductId.bstrVal) == 0 && _tcscmp(varPlatinumPackageId.bstrVal, varPackagesId.bstrVal) == 0 && varGiveType.intVal == 1)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits && varPlatinumPackageId.vt != VT_EMPTY && varPlatinumPackageId.vt != VT_NULL)
|
|
|
+ {
|
|
|
+ ptrPlatinum->AddNew();
|
|
|
+ ptrPlatinum->PutCollect(_T("Pgm_GiveType"), 1);
|
|
|
+ ptrPlatinum->PutCollect(_T("Pgm_ProductNumber"), varPlatinumGoodsId);
|
|
|
+ ptrPlatinum->PutCollect(_T("Pgm_Quantity"), VARINT(ptrClassic->GetCollect(_T("shuliang"))));
|
|
|
+ ptrPlatinum->PutCollect(_T("Pgm_PackagesNumber"), varPlatinumPackageTypeId);//套系类型ID;
|
|
|
+ ptrPlatinum->PutCollect(_T("Pgm_PackagesName"), varPlatinumPackageName);
|
|
|
+ ptrPlatinum->PutCollect(_T("Pgm_PackagesCode"), varPlatinumPackageId);
|
|
|
+ ptrPlatinum->PutCollect(_T("Pgm_ProductName"), ptrClassic->GetCollect(_T("spname")));
|
|
|
+ ptrPlatinum->PutCollect(_T("Pgm_IntoRegisterQuantity"), 0);
|
|
|
+ ptrPlatinum->PutCollect(_T("Pgm_IntoBottomQuantity"), 0);
|
|
|
+ ptrPlatinum->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->MoveFirst();
|
|
|
+ ptrClassic->MoveNext();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrClassic->Close();
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d,商品名=%s =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, m_strMsg, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pScenicSpot()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // 声明记录集指针;
|
|
|
+ _RecordsetPtr ptrClassic;
|
|
|
+ _RecordsetPtr ptrPlatinum;
|
|
|
+ // 创建实例;
|
|
|
+ ptrClassic.CreateInstance(__uuidof(Recordset));
|
|
|
+ ptrPlatinum.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = ptrClassic->Open(_T("select * from jd"), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ hr = ptrPlatinum->Open(_T("select * from tb_ErpTheScenery"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ bool bExsits = false;
|
|
|
+
|
|
|
+ while (ptrClassic->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ // 同时添加普通景点和儿童阶段;
|
|
|
+ auto func = [&, this](int n) {
|
|
|
+ CString str;
|
|
|
+ _RecordsetPtr rs;
|
|
|
+ rs.CreateInstance(__uuidof(Recordset));
|
|
|
+ //str.Format(_T("select c2p_jdid from tb_ErpTheScenery where c2p_jdid = '%s_%d' and Tsc_Type = '%d'"), Global::g_szClassicBranchId, ptrClassic->GetCollect(_T("id")).intVal, n);
|
|
|
+ str.Format(_T("select id from tb_ErpTheScenery where Tsc_Name = '%s' and Tsc_Type = '%d'"), ptrClassic->GetCollect(_T("name")).intVal, n);
|
|
|
+ hr = rs->Open(_variant_t(str), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenForwardOnly, adLockReadOnly, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ if (rs->adoEOF == VARIANT_TRUE)
|
|
|
+ {
|
|
|
+ // 不存在;
|
|
|
+ ptrPlatinum->AddNew();
|
|
|
+ //ptrPlatinum->PutCollect(_T("c2p_jdid"), ptrClassic->GetCollect(_T("id")));
|
|
|
+ ptrPlatinum->PutCollect(_T("Tsc_Type"), n);
|
|
|
+ ptrPlatinum->PutCollect(_T("Tcs_Category"), 0);
|
|
|
+ ptrPlatinum->PutCollect(_T("Tsc_IsDisable"), 0);
|
|
|
+ ptrPlatinum->PutCollect(_T("Tsc_DividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ ptrPlatinum->PutCollect(_T("Tsc_CostPrice"), 0);
|
|
|
+ ptrPlatinum->PutCollect(_T("Tsc_SalesPrice"), 0);
|
|
|
+ ptrPlatinum->PutCollect(_T("Tsc_PackagesMainClass"), 0);
|
|
|
+ ptrPlatinum->PutCollect(_T("Tsc_Name"), ptrClassic->GetCollect(_T("name")));
|
|
|
+ ptrPlatinum->PutCollect(_T("Tsc_Rating"), _T("BEBBBCADDEBFJDFFC"));//一级;
|
|
|
+ ptrPlatinum->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ rs->Close();
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ func(0);
|
|
|
+ func(1);
|
|
|
+
|
|
|
+ ptrClassic->MoveNext();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrClassic->Close();
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pCustomerRelationShip()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // 声明记录集指针;
|
|
|
+ _RecordsetPtr ptrPlatinum;
|
|
|
+ // 创建实例;
|
|
|
+ ptrPlatinum.CreateInstance(__uuidof(Recordset));
|
|
|
+ // AAAAAAB;BEBBBCADFEBEJBGD;BEBACCAFFHEAJICDF;BEBACCAFEGECFBJFD
|
|
|
+ HRESULT hr = ptrPlatinum->Open(_T("select * from tb_ErpSystemCategory"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ // 获取铂金版父类id;
|
|
|
+ int nRelationShipId = -1;
|
|
|
+
|
|
|
+ while (ptrPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ _variant_t gid = ptrPlatinum->GetCollect(_T("Sc_ClassCode"));
|
|
|
+
|
|
|
+ if (_tcscmp(_T("BFABDBAJBJCEBDJCJ"), gid.bstrVal) == 0)
|
|
|
+ {
|
|
|
+ nRelationShipId = ptrPlatinum->GetCollect(_T("ID"));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ {
|
|
|
+ // 家长;
|
|
|
+ bool bExsits = false;
|
|
|
+ ptrPlatinum->MoveFirst();
|
|
|
+
|
|
|
+ while (ptrPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (_tcscmp(ptrPlatinum->GetCollect(_T("Sc_ClassName")).bstrVal, _T("家长")) == 0 &&
|
|
|
+ ptrPlatinum->GetCollect(_T("Sc_ClassParentID")).intVal == nRelationShipId)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits)
|
|
|
+ {
|
|
|
+ ptrPlatinum->AddNew();
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_ClassName"), _T("家长"));
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_ClassParentID"), nRelationShipId);
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_ClassCode"), [this]()->_variant_t {
|
|
|
+ TCHAR szUid[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 24, 10);
|
|
|
+
|
|
|
+ for (int i = 0; i < _tcslen(szUid); i++)
|
|
|
+ {
|
|
|
+ szUid[i] += 17;
|
|
|
+ }
|
|
|
+
|
|
|
+ return szUid;
|
|
|
+ }());
|
|
|
+
|
|
|
+ // 其他非空类;
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_IsDisable"), false);
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_IsReadOnly"), false);
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_IsEnabledURL"), false);
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_CreateDatetime"), []() ->_variant_t {
|
|
|
+ time_t osBinaryTime;
|
|
|
+ time(&osBinaryTime);
|
|
|
+ COleDateTime time1(osBinaryTime);
|
|
|
+ return time1.m_dt;
|
|
|
+ }());
|
|
|
+ ptrPlatinum->Update();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ {
|
|
|
+ // 夫妻;
|
|
|
+ bool bExsits = false;
|
|
|
+ ptrPlatinum->MoveFirst();
|
|
|
+
|
|
|
+ while (ptrPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (_tcscmp(ptrPlatinum->GetCollect(_T("Sc_ClassName")).bstrVal, _T("夫妻")) == 0 &&
|
|
|
+ ptrPlatinum->GetCollect(_T("Sc_ClassParentID")).intVal == nRelationShipId)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits)
|
|
|
+ {
|
|
|
+ ptrPlatinum->AddNew();
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_ClassName"), _T("夫妻"));
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_ClassParentID"), nRelationShipId);
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_ClassCode"), [this]()->_variant_t {
|
|
|
+ TCHAR szUid[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 24, 10);
|
|
|
+
|
|
|
+ for (int i = 0; i < _tcslen(szUid); i++)
|
|
|
+ {
|
|
|
+ szUid[i] += 17;
|
|
|
+ }
|
|
|
+
|
|
|
+ return szUid;
|
|
|
+ }());
|
|
|
+
|
|
|
+ // 其他非空类;
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_IsDisable"), false);
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_IsReadOnly"), false);
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_IsEnabledURL"), false);
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_CreateDatetime"), []() ->_variant_t {
|
|
|
+ time_t osBinaryTime;
|
|
|
+ time(&osBinaryTime);
|
|
|
+ COleDateTime time1(osBinaryTime);
|
|
|
+ return time1.m_dt;
|
|
|
+ }());
|
|
|
+ ptrPlatinum->Update();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->Close();
|
|
|
+
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pCustomerSource()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // 声明记录集指针;
|
|
|
+ _RecordsetPtr ptrClassic;
|
|
|
+ _RecordsetPtr ptrPlatinum;
|
|
|
+ // 创建实例;
|
|
|
+ ptrClassic.CreateInstance(__uuidof(Recordset));
|
|
|
+ ptrPlatinum.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = ptrClassic->Open(_T("select * from clientfrom"), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ // AAAAAAF
|
|
|
+ hr = ptrPlatinum->Open(_T("select * from tb_ErpSystemCategory"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ // 获取铂金版父类id;
|
|
|
+ int nSourceId = -1;
|
|
|
+
|
|
|
+ while (ptrPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (_tcscmp(_T("AAAAAAF"), ptrPlatinum->GetCollect(_T("Sc_ClassCode")).bstrVal) == 0)
|
|
|
+ {
|
|
|
+ nSourceId = ptrPlatinum->GetCollect(_T("ID"));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ bool bExsits = false;
|
|
|
+
|
|
|
+ while (ptrClassic->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ // 获取名称 ;
|
|
|
+ _variant_t varName = ptrClassic->GetCollect(_T("name"));
|
|
|
+ // 判断是否存在;
|
|
|
+ bExsits = false;
|
|
|
+
|
|
|
+ while (ptrPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (_tcscmp(varName.bstrVal, ptrPlatinum->GetCollect(_T("Sc_ClassName")).bstrVal) == 0
|
|
|
+ && ptrPlatinum->GetCollect(_T("Sc_ClassParentID")).intVal == nSourceId)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits)
|
|
|
+ {
|
|
|
+ ptrPlatinum->AddNew();
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_ClassName"), varName);
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_ClassParentID"), nSourceId);
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_ClassCode"), [this]()->_variant_t {
|
|
|
+ TCHAR szUid[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 24, 10);
|
|
|
+
|
|
|
+ for (int i = 0; i < _tcslen(szUid); i++)
|
|
|
+ {
|
|
|
+ szUid[i] += 17;
|
|
|
+ }
|
|
|
+
|
|
|
+ return szUid;
|
|
|
+ }());
|
|
|
+
|
|
|
+ // 其他非空类;
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_IsDisable"), false);
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_IsReadOnly"), false);
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_IsEnabledURL"), false);
|
|
|
+ ptrPlatinum->PutCollect(_T("Sc_CreateDatetime"), []() ->_variant_t {
|
|
|
+ time_t osBinaryTime;
|
|
|
+ time(&osBinaryTime);
|
|
|
+ COleDateTime time1(osBinaryTime);
|
|
|
+ return time1.m_dt;
|
|
|
+ }());
|
|
|
+ ptrPlatinum->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->MoveFirst();
|
|
|
+ ptrClassic->MoveNext();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrClassic->Close();
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pPaymentMethod()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ _RecordsetPtr rsPlatinum;
|
|
|
+ rsPlatinum.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = rsPlatinum->Open(_T("select * from tb_ErpSystemCategory "), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ // BEBACCAFCCEAGAIHH;
|
|
|
+ _variant_t varID = VT_NULL;
|
|
|
+
|
|
|
+ while (rsPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (_tcscmp(rsPlatinum->GetCollect(_T("Sc_ClassCode")).bstrVal, _T("BEBACCAFCCEAGAIHH")) == 0)
|
|
|
+ {
|
|
|
+ varID = rsPlatinum->GetCollect(_T("ID"));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ bool bExsits = false;
|
|
|
+ {
|
|
|
+ //支付宝
|
|
|
+ rsPlatinum->MoveFirst();
|
|
|
+
|
|
|
+ while (rsPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (rsPlatinum->GetCollect(_T("Sc_ClassParentID")) == varID && _tcscmp(rsPlatinum->GetCollect(_T("Sc_ClassName")).bstrVal, _T("支付宝")) == 0)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits)
|
|
|
+ {
|
|
|
+ // 添加订单类别: 经典订单;
|
|
|
+ rsPlatinum->AddNew();
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassName"), _T("支付宝"));
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassCode"), [this]()->_variant_t {
|
|
|
+ TCHAR szUid[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 24, 10);
|
|
|
+
|
|
|
+ for (int i = 0; i < _tcslen(szUid); i++)
|
|
|
+ {
|
|
|
+ szUid[i] += 17;
|
|
|
+ }
|
|
|
+
|
|
|
+ return szUid;
|
|
|
+ }());
|
|
|
+
|
|
|
+ // 其他非空类;
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsDisable"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsReadOnly"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsEnabledURL"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassParentID"), varID);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_CreateDatetime"), []() ->_variant_t {
|
|
|
+ time_t osBinaryTime;
|
|
|
+ time(&osBinaryTime);
|
|
|
+ COleDateTime time1(osBinaryTime);
|
|
|
+ return time1.m_dt;
|
|
|
+ }());
|
|
|
+
|
|
|
+ rsPlatinum->Update();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ {
|
|
|
+ //财会通
|
|
|
+ bExsits = false;
|
|
|
+ rsPlatinum->MoveFirst();
|
|
|
+
|
|
|
+ while (rsPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (rsPlatinum->GetCollect(_T("Sc_ClassParentID")) == varID && _tcscmp(rsPlatinum->GetCollect(_T("Sc_ClassName")).bstrVal, _T("财会通")) == 0)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits)
|
|
|
+ {
|
|
|
+ // 添加订单类别: 经典订单;
|
|
|
+ rsPlatinum->AddNew();
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassName"), _T("财会通"));
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassCode"), [this]()->_variant_t {
|
|
|
+ TCHAR szUid[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 24, 10);
|
|
|
+
|
|
|
+ for (int i = 0; i < _tcslen(szUid); i++)
|
|
|
+ {
|
|
|
+ szUid[i] += 17;
|
|
|
+ }
|
|
|
+
|
|
|
+ return szUid;
|
|
|
+ }());
|
|
|
+
|
|
|
+ // 其他非空类;
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsDisable"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsReadOnly"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsEnabledURL"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassParentID"), varID);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_CreateDatetime"), []() ->_variant_t {
|
|
|
+ time_t osBinaryTime;
|
|
|
+ time(&osBinaryTime);
|
|
|
+ COleDateTime time1(osBinaryTime);
|
|
|
+ return time1.m_dt;
|
|
|
+ }());
|
|
|
+
|
|
|
+ rsPlatinum->Update();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ {
|
|
|
+ //微信支付
|
|
|
+ bExsits = false;
|
|
|
+ rsPlatinum->MoveFirst();
|
|
|
+
|
|
|
+ while (rsPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (rsPlatinum->GetCollect(_T("Sc_ClassParentID")) == varID && _tcscmp(rsPlatinum->GetCollect(_T("Sc_ClassName")).bstrVal, _T("微信支付")) == 0)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits)
|
|
|
+ {
|
|
|
+ // 添加订单类别: 经典订单;
|
|
|
+ rsPlatinum->AddNew();
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassName"), _T("微信支付"));
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassCode"), [this]()->_variant_t {
|
|
|
+ TCHAR szUid[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 24, 10);
|
|
|
+
|
|
|
+ for (int i = 0; i < _tcslen(szUid); i++)
|
|
|
+ {
|
|
|
+ szUid[i] += 17;
|
|
|
+ }
|
|
|
+
|
|
|
+ return szUid;
|
|
|
+ }());
|
|
|
+
|
|
|
+ // 其他非空类;
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsDisable"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsReadOnly"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsEnabledURL"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassParentID"), varID);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_CreateDatetime"), []() ->_variant_t {
|
|
|
+ time_t osBinaryTime;
|
|
|
+ time(&osBinaryTime);
|
|
|
+ COleDateTime time1(osBinaryTime);
|
|
|
+ return time1.m_dt;
|
|
|
+ }());
|
|
|
+
|
|
|
+ rsPlatinum->Update();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ {
|
|
|
+ //自定义,有些老的数据库可能没有这个表;
|
|
|
+ _RecordsetPtr rsPaymentMethod;
|
|
|
+ rsPaymentMethod.CreateInstance(__uuidof(Recordset));
|
|
|
+ hr = rsPaymentMethod->Open(_T("select * from CustomPayType"), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ _variant_t varPaymentName;
|
|
|
+
|
|
|
+ while (rsPaymentMethod->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ bExsits = false;
|
|
|
+ rsPlatinum->MoveFirst();
|
|
|
+ varPaymentName = rsPaymentMethod->GetCollect(_T("TypeName"));
|
|
|
+
|
|
|
+ while (rsPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (rsPlatinum->GetCollect(_T("Sc_ClassParentID")) == varID && _tcscmp(rsPlatinum->GetCollect(_T("Sc_ClassName")).bstrVal, varPaymentName.bstrVal) == 0)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits)
|
|
|
+ {
|
|
|
+ // 添加订单类别: 经典订单;
|
|
|
+ rsPlatinum->AddNew();
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassName"), varPaymentName);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassCode"), [this]()->_variant_t {
|
|
|
+ TCHAR szUid[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 24, 10);
|
|
|
+
|
|
|
+ for (int i = 0; i < _tcslen(szUid); i++)
|
|
|
+ {
|
|
|
+ szUid[i] += 17;
|
|
|
+ }
|
|
|
+
|
|
|
+ return szUid;
|
|
|
+ }());
|
|
|
+
|
|
|
+ // 其他非空类;
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsDisable"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsReadOnly"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsEnabledURL"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassParentID"), varID);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_CreateDatetime"), []() ->_variant_t {
|
|
|
+ time_t osBinaryTime;
|
|
|
+ time(&osBinaryTime);
|
|
|
+ COleDateTime time1(osBinaryTime);
|
|
|
+ return time1.m_dt;
|
|
|
+ }());
|
|
|
+
|
|
|
+ rsPlatinum->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPaymentMethod->MoveNext();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error& e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pTwopinType()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ _RecordsetPtr rsPlatinum;
|
|
|
+ rsPlatinum.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = rsPlatinum->Open(_T("select * from tb_ErpSystemCategory "), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ // BEBACCAFCCEAGAIHH;
|
|
|
+ _variant_t varID = VT_NULL;
|
|
|
+
|
|
|
+ while (rsPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (_tcscmp(rsPlatinum->GetCollect(_T("Sc_ClassCode")).bstrVal, _T("BEBACDAJDFDDEACGJ")) == 0)
|
|
|
+ {
|
|
|
+ varID = rsPlatinum->GetCollect(_T("ID"));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ bool bExsits = false;
|
|
|
+ {
|
|
|
+ //摄影二销
|
|
|
+ rsPlatinum->MoveFirst();
|
|
|
+
|
|
|
+ while (rsPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (rsPlatinum->GetCollect(_T("Sc_ClassParentID")) == varID && _tcscmp(rsPlatinum->GetCollect(_T("Sc_ClassName")).bstrVal, _T("摄影二销")) == 0)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits)
|
|
|
+ {
|
|
|
+ // 添加订单类别: 经典订单;
|
|
|
+ rsPlatinum->AddNew();
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassName"), _T("摄影二销"));
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassCode"), [this]()->_variant_t {
|
|
|
+ TCHAR szUid[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 24, 10);
|
|
|
+
|
|
|
+ for (int i = 0; i < _tcslen(szUid); i++)
|
|
|
+ {
|
|
|
+ szUid[i] += 17;
|
|
|
+ }
|
|
|
+
|
|
|
+ return szUid;
|
|
|
+ }());
|
|
|
+
|
|
|
+ // 其他非空类;
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsDisable"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsReadOnly"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsEnabledURL"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassParentID"), varID);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_CreateDatetime"), []() ->_variant_t {
|
|
|
+ time_t osBinaryTime;
|
|
|
+ time(&osBinaryTime);
|
|
|
+ COleDateTime time1(osBinaryTime);
|
|
|
+ return time1.m_dt;
|
|
|
+ }());
|
|
|
+
|
|
|
+ rsPlatinum->Update();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ {
|
|
|
+ //选片二销
|
|
|
+ rsPlatinum->MoveFirst();
|
|
|
+ bExsits = false;
|
|
|
+
|
|
|
+ while (rsPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (rsPlatinum->GetCollect(_T("Sc_ClassParentID")) == varID && _tcscmp(rsPlatinum->GetCollect(_T("Sc_ClassName")).bstrVal, _T("选片二销")) == 0)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits)
|
|
|
+ {
|
|
|
+ // 添加订单类别: 经典订单;
|
|
|
+ rsPlatinum->AddNew();
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassName"), _T("选片二销"));
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassCode"), [this]()->_variant_t {
|
|
|
+ TCHAR szUid[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 24, 10);
|
|
|
+
|
|
|
+ for (int i = 0; i < _tcslen(szUid); i++)
|
|
|
+ {
|
|
|
+ szUid[i] += 17;
|
|
|
+ }
|
|
|
+
|
|
|
+ return szUid;
|
|
|
+ }());
|
|
|
+
|
|
|
+ // 其他非空类;
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsDisable"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsReadOnly"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsEnabledURL"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassParentID"), varID);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_CreateDatetime"), []() ->_variant_t {
|
|
|
+ time_t osBinaryTime;
|
|
|
+ time(&osBinaryTime);
|
|
|
+ COleDateTime time1(osBinaryTime);
|
|
|
+ return time1.m_dt;
|
|
|
+ }());
|
|
|
+
|
|
|
+ rsPlatinum->Update();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ {
|
|
|
+ //化妆二销
|
|
|
+ rsPlatinum->MoveFirst();
|
|
|
+ bExsits = false;
|
|
|
+
|
|
|
+ while (rsPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (rsPlatinum->GetCollect(_T("Sc_ClassParentID")) == varID && _tcscmp(rsPlatinum->GetCollect(_T("Sc_ClassName")).bstrVal, _T("化妆二销")) == 0)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits)
|
|
|
+ {
|
|
|
+ // 添加订单类别: 经典订单;
|
|
|
+ rsPlatinum->AddNew();
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassName"), _T("化妆二销"));
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassCode"), [this]()->_variant_t {
|
|
|
+ TCHAR szUid[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 24, 10);
|
|
|
+
|
|
|
+ for (int i = 0; i < _tcslen(szUid); i++)
|
|
|
+ {
|
|
|
+ szUid[i] += 17;
|
|
|
+ }
|
|
|
+
|
|
|
+ return szUid;
|
|
|
+ }());
|
|
|
+
|
|
|
+ // 其他非空类;
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsDisable"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsReadOnly"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsEnabledURL"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassParentID"), varID);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_CreateDatetime"), []() ->_variant_t {
|
|
|
+ time_t osBinaryTime;
|
|
|
+ time(&osBinaryTime);
|
|
|
+ COleDateTime time1(osBinaryTime);
|
|
|
+ return time1.m_dt;
|
|
|
+ }());
|
|
|
+
|
|
|
+ rsPlatinum->Update();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ {
|
|
|
+ //引导二销
|
|
|
+ rsPlatinum->MoveFirst();
|
|
|
+ bExsits = false;
|
|
|
+
|
|
|
+ while (rsPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (rsPlatinum->GetCollect(_T("Sc_ClassParentID")) == varID && _tcscmp(rsPlatinum->GetCollect(_T("Sc_ClassName")).bstrVal, _T("引导二销")) == 0)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits)
|
|
|
+ {
|
|
|
+ // 添加订单类别: 经典订单;
|
|
|
+ rsPlatinum->AddNew();
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassName"), _T("引导二销"));
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassCode"), [this]()->_variant_t {
|
|
|
+ TCHAR szUid[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 24, 10);
|
|
|
+
|
|
|
+ for (int i = 0; i < _tcslen(szUid); i++)
|
|
|
+ {
|
|
|
+ szUid[i] += 17;
|
|
|
+ }
|
|
|
+
|
|
|
+ return szUid;
|
|
|
+ }());
|
|
|
+
|
|
|
+ // 其他非空类;
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsDisable"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsReadOnly"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsEnabledURL"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassParentID"), varID);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_CreateDatetime"), []() ->_variant_t {
|
|
|
+ time_t osBinaryTime;
|
|
|
+ time(&osBinaryTime);
|
|
|
+ COleDateTime time1(osBinaryTime);
|
|
|
+ return time1.m_dt;
|
|
|
+ }());
|
|
|
+
|
|
|
+ rsPlatinum->Update();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ {
|
|
|
+ //自定义
|
|
|
+ _RecordsetPtr rsPaymentMethod;
|
|
|
+ rsPaymentMethod.CreateInstance(__uuidof(Recordset));
|
|
|
+ hr = rsPaymentMethod->Open(_T("select * from expendtype"), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ _variant_t varName;
|
|
|
+
|
|
|
+ while (rsPaymentMethod->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ bExsits = false;
|
|
|
+ rsPlatinum->MoveFirst();
|
|
|
+ varName = rsPaymentMethod->GetCollect(_T("name"));
|
|
|
+
|
|
|
+ while (rsPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (rsPlatinum->GetCollect(_T("Sc_ClassParentID")) == varID && _tcscmp(rsPlatinum->GetCollect(_T("Sc_ClassName")).bstrVal, varName.bstrVal) == 0)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits)
|
|
|
+ {
|
|
|
+ // 添加订单类别: 经典订单;
|
|
|
+ rsPlatinum->AddNew();
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassName"), varName);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassCode"), [this]()->_variant_t {
|
|
|
+ TCHAR szUid[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 24, 10);
|
|
|
+
|
|
|
+ for (int i = 0; i < _tcslen(szUid); i++)
|
|
|
+ {
|
|
|
+ szUid[i] += 17;
|
|
|
+ }
|
|
|
+
|
|
|
+ return szUid;
|
|
|
+ }());
|
|
|
+
|
|
|
+ // 其他非空类;
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsDisable"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsReadOnly"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsEnabledURL"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassParentID"), varID);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_CreateDatetime"), []() ->_variant_t {
|
|
|
+ time_t osBinaryTime;
|
|
|
+ time(&osBinaryTime);
|
|
|
+ COleDateTime time1(osBinaryTime);
|
|
|
+ return time1.m_dt;
|
|
|
+ }());
|
|
|
+
|
|
|
+ rsPlatinum->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPaymentMethod->MoveNext();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error& e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pClientRegion()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ _RecordsetPtr rsPlatinum;
|
|
|
+ rsPlatinum.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = rsPlatinum->Open(_T("select * from tb_ErpSystemCategory "), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ // AAAAAAC;
|
|
|
+ _variant_t varID;
|
|
|
+
|
|
|
+ while (rsPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (_tcscmp(rsPlatinum->GetCollect(_T("Sc_ClassCode")).bstrVal, _T("AAAAAAC")) == 0)
|
|
|
+ {
|
|
|
+ varID = rsPlatinum->GetCollect(_T("ID"));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ bool bExsits = false;
|
|
|
+ {
|
|
|
+ //自定义,有些老的数据库可能没有这个表;
|
|
|
+ _RecordsetPtr rsClientRegion;
|
|
|
+ rsClientRegion.CreateInstance(__uuidof(Recordset));
|
|
|
+ hr = rsClientRegion->Open(_T("select * from area"), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ _variant_t varRegionName;
|
|
|
+
|
|
|
+ while (rsClientRegion->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ bExsits = false;
|
|
|
+ rsPlatinum->MoveFirst();
|
|
|
+ varRegionName = rsClientRegion->GetCollect(_T("name"));
|
|
|
+
|
|
|
+ while (rsPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (rsPlatinum->GetCollect(_T("Sc_ClassParentID")) == varID && _tcscmp(rsPlatinum->GetCollect(_T("Sc_ClassName")).bstrVal, varRegionName.bstrVal) == 0)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits)
|
|
|
+ {
|
|
|
+ // 添加订单类别: 经典订单;
|
|
|
+ rsPlatinum->AddNew();
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassName"), varRegionName);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassCode"), [this]()->_variant_t {
|
|
|
+ TCHAR szUid[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 24, 10);
|
|
|
+
|
|
|
+ for (int i = 0; i < _tcslen(szUid); i++)
|
|
|
+ {
|
|
|
+ szUid[i] += 17;
|
|
|
+ }
|
|
|
+
|
|
|
+ return szUid;
|
|
|
+ }());
|
|
|
+
|
|
|
+ // 其他非空类;
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsDisable"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsReadOnly"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsEnabledURL"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassParentID"), varID);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_CreateDatetime"), []() ->_variant_t {
|
|
|
+ time_t osBinaryTime;
|
|
|
+ time(&osBinaryTime);
|
|
|
+ COleDateTime time1(osBinaryTime);
|
|
|
+ return time1.m_dt;
|
|
|
+ }());
|
|
|
+
|
|
|
+ rsPlatinum->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsClientRegion->MoveNext();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ rsPlatinum->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error& e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pOrderType()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ _RecordsetPtr rsPlatinum;
|
|
|
+ rsPlatinum.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = rsPlatinum->Open(_T("select * from tb_ErpSystemCategory "), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ // BFAGAHBFDGCABAJIH;
|
|
|
+ _variant_t varID = VT_NULL;
|
|
|
+
|
|
|
+ while (rsPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (_tcscmp(rsPlatinum->GetCollect(_T("Sc_ClassCode")).bstrVal, _T("BFAGAHBFDGCABAJIH")) == 0)
|
|
|
+ {
|
|
|
+ varID = rsPlatinum->GetCollect(_T("ID"));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveFirst();
|
|
|
+
|
|
|
+ bool bExsits = false;
|
|
|
+
|
|
|
+ while (rsPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (rsPlatinum->GetCollect(_T("Sc_ClassParentID")) == varID && _tcscmp(rsPlatinum->GetCollect(_T("Sc_ClassName")).bstrVal, _T("经典订单")) == 0)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (bExsits)
|
|
|
+ return;
|
|
|
+
|
|
|
+ // 添加订单类别: 经典订单;
|
|
|
+ rsPlatinum->AddNew();
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassName"), _T("经典订单"));
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassCode"), [this]()->_variant_t {
|
|
|
+ TCHAR szUid[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 24, 10);
|
|
|
+
|
|
|
+ for (int i = 0; i < _tcslen(szUid); i++)
|
|
|
+ {
|
|
|
+ szUid[i] += 17;
|
|
|
+ }
|
|
|
+
|
|
|
+ return szUid;
|
|
|
+ }());
|
|
|
+
|
|
|
+ // 其他非空类;
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsDisable"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsReadOnly"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsEnabledURL"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassParentID"), varID);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_CreateDatetime"), []() ->_variant_t {
|
|
|
+ time_t osBinaryTime;
|
|
|
+ time(&osBinaryTime);
|
|
|
+ COleDateTime time1(osBinaryTime);
|
|
|
+ return time1.m_dt;
|
|
|
+ }());
|
|
|
+
|
|
|
+ rsPlatinum->Update();
|
|
|
+ rsPlatinum->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error& e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pCustomerOrder(CString strOrder)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ CString strSql;
|
|
|
+ // 声明记录集指针;
|
|
|
+ _RecordsetPtr ptrClassic;
|
|
|
+ _RecordsetPtr ptrPlatinum;
|
|
|
+ // 创建实例;
|
|
|
+ ptrClassic.CreateInstance(__uuidof(Recordset));
|
|
|
+ ptrPlatinum.CreateInstance(__uuidof(Recordset));
|
|
|
+
|
|
|
+ if (!strOrder.IsEmpty())
|
|
|
+ strSql.Format(_T("select * from dindan where id = '%s'"), strOrder);
|
|
|
+ else
|
|
|
+ strSql = _T("select * from dindan");
|
|
|
+
|
|
|
+ HRESULT hr = ptrClassic->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ hr = ptrPlatinum->Open(_T("select * from tb_ErpOrder"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenStatic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ bool bConverted = false;
|
|
|
+
|
|
|
+ // 遍历经典数据;
|
|
|
+ while (ptrClassic->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ // 判断订单是否已经转换过;
|
|
|
+ _variant_t varClassicOrder = ptrClassic->GetCollect(_T("id"));
|
|
|
+ strSql.Format(_T("%s%s"), Global::g_szClassicBranchId, varClassicOrder.bstrVal);
|
|
|
+ _variant_t varOrderNumber = strSql;
|
|
|
+ m_strMsg = varClassicOrder.bstrVal;
|
|
|
+#ifdef _DEBUG
|
|
|
+
|
|
|
+ if (_tcscmp(varOrderNumber.bstrVal, _T("JJ20170816-001")) == 0)
|
|
|
+ {
|
|
|
+ WriteTextLog(_T("c2pCustomerOrder"));
|
|
|
+ }
|
|
|
+
|
|
|
+#endif
|
|
|
+ bConverted = c2pOrderNumberExists(varOrderNumber);
|
|
|
+
|
|
|
+ if (!bConverted)
|
|
|
+ {
|
|
|
+ // 获取订单类别;
|
|
|
+ ptrPlatinum->AddNew();
|
|
|
+ //_variant_t varId;
|
|
|
+ //ptrPlatinum->PutCollect(_T("c2p_order"), varId = ptrClassic->GetCollect(_T("id")));
|
|
|
+ ptrPlatinum->PutCollect(_T("Ord_DividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ // 订单号;
|
|
|
+ ptrPlatinum->PutCollect(_T("Ord_Number"), varOrderNumber);
|
|
|
+ ptrPlatinum->PutCollect(_T("Ord_SinceOrderNumber"), _variant_t(strSql));
|
|
|
+ // 订单类型,根据加密狗来识别或手动设置;
|
|
|
+ _variant_t txtype = ptrClassic->GetCollect(_T("txtype"));
|
|
|
+
|
|
|
+ if (Global::g_bChildVersion)
|
|
|
+ {
|
|
|
+ if (isChildOrderType(txtype))
|
|
|
+ ptrPlatinum->PutCollect(_T("Ord_Type"), 1);
|
|
|
+ else
|
|
|
+ ptrPlatinum->PutCollect(_T("Ord_Type"), 2);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //婚纱订单;
|
|
|
+ ptrPlatinum->PutCollect(_T("Ord_Type"), 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->PutCollect(_T("Ord_Class"), _T("1"));// 客户订单;
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_CustomerListID"), _T(""));
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_MainContact"), _T(""));
|
|
|
+ ptrPlatinum->PutCollect(_T("Ord_OrderClass"), _T("经典订单"));//订单套系类别;
|
|
|
+
|
|
|
+ ptrPlatinum->PutCollect(_T("Ord_PhotographyCategory"), txtype);//套系类别
|
|
|
+ ptrPlatinum->PutCollect(_T("Ord_CustomerSource"), ptrClassic->GetCollect(_T("from")));//客户来源;
|
|
|
+ ptrPlatinum->PutCollect(_T("Ord_SeriesName"), ptrClassic->GetCollect(_T("taoxiname")));//套系名称
|
|
|
+ /*ptrPlatinum->PutCollect(_T("Ord_SeriesPrice"), [&, this]()->_variant_t {
|
|
|
+ // 经典版中,该字段可能带有中文;//2229元;
|
|
|
+ _variant_t var = ptrClassic->GetCollect(_T("taoxijiage"));
|
|
|
+
|
|
|
+ if (var.vt == VT_EMPTY || var.vt == VT_NULL || _tcscmp(var.bstrVal, _T("")) == 0)
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ return _ttoi(var.bstrVal);
|
|
|
+ }());//套系价格*/
|
|
|
+ PRICENULL(ptrPlatinum, _T("Ord_SeriesPrice"), ptrClassic->GetCollect(_T("taoxijiage")));
|
|
|
+ ptrPlatinum->PutCollect(_T("Ord_Discount"), VARINT(ptrClassic->GetCollect(_T("discount"))));
|
|
|
+ ptrPlatinum->PutCollect(_T("Ord_AfterDiscount"), VARINT(ptrClassic->GetCollect(_T("discount2"))));
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_Authorize"), _T(""));
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_AfterAuthorize"), _T(""));
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_Price"), ptrClassic->GetCollect(_T("payed1")));//预约收款
|
|
|
+ PRICENULL(ptrPlatinum, _T("Ord_Price"), ptrClassic->GetCollect(_T("payed1")));
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_IntoRegister"), _T(""));//入册
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_IntoBottom"), _T(""));//入底
|
|
|
+ // 入底\入册;
|
|
|
+ [&, this]() {
|
|
|
+ CString str = ptrClassic->GetCollect(_T("taoxizs")).bstrVal;
|
|
|
+ int nAlbum = -1; // 入册数量,默认-1表示全送;
|
|
|
+ int nNegative = -1;// 入底数量,默认-1表示全送;
|
|
|
+ int nIndex = str.Find(_T("\\"));
|
|
|
+
|
|
|
+ if (nIndex == -1)
|
|
|
+ return;
|
|
|
+
|
|
|
+ // 入底;
|
|
|
+ bool bDigit = true;
|
|
|
+
|
|
|
+ // 使用isdigit会出错,宽字符下;
|
|
|
+ if (!str.Left(nIndex).SpanIncluding(_T("0123456789")))
|
|
|
+ {
|
|
|
+ bDigit = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (bDigit)
|
|
|
+ nNegative = _ttoi(str.Left(nIndex));
|
|
|
+
|
|
|
+ ptrPlatinum->PutCollect(_T("Ord_IntoBottom"), nNegative);
|
|
|
+
|
|
|
+ // 入册;
|
|
|
+ bDigit = true;
|
|
|
+
|
|
|
+ // 使用isdigit会出错,宽字符下;
|
|
|
+ if (!str.Mid(nIndex + 1).SpanIncluding(_T("0123456789")))
|
|
|
+ {
|
|
|
+ bDigit = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (bDigit)
|
|
|
+ nAlbum = _ttoi(str.Mid(nIndex + 1));
|
|
|
+
|
|
|
+ ptrPlatinum->PutCollect(_T("Ord_IntoBottom"), nAlbum);
|
|
|
+
|
|
|
+ }();
|
|
|
+
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_LovedStyle"), _T(""));//喜爱格调
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_RealPickQuantity"), _T(""));//选片张数
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_PlusPickNumber"), _T(""));//入底加挑张数
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_PhotoCategoryTheme"), _T(""));
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_PhotoPath"), _T(""));//相片路径
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_PhotoBackupPath"), _T(""));//相片备份路径
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_SelectionFilm"), _T(""));
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_SelectionDesign"), _T(""));
|
|
|
+ if (ptrClassic->GetCollect(_T("bz")).vt != VT_NULL)
|
|
|
+ {
|
|
|
+ // 长度问题造成出错->铂金长度=800, 经典长度=max;
|
|
|
+ CString strBz = ptrClassic->GetCollect(_T("bz")).bstrVal;
|
|
|
+ ptrPlatinum->PutCollect(_T("Ord_Remark"), _variant_t(strBz.Left(800)));//订单备注
|
|
|
+ }
|
|
|
+
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_CreateDateTime"), Global::String2Date(ptrClassic->GetCollect(_T("time1"))));
|
|
|
+ DATENULL(ptrPlatinum, _T("Ord_CreateDateTime"), ptrClassic->GetCollect(_T("time1")));
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_CreateName"), _T(""));
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_UpdateDateTime"), _T(""));
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_UpdateName"), _T(""));
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_IntoBookPickQuantity"), _T(""));//入册加挑张数
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_HotelInfo"), _T(""));
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_PackageName"), _T(""));//礼包套系名称
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_PackagePrice"), _T(""));//礼包价格
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_SaveOrderDateTime"), _T(""));
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_OrderAnnotation"), _T(""));
|
|
|
+ // 主副门市;
|
|
|
+ _variant_t employeeId;
|
|
|
+ _variant_t employeeId2;
|
|
|
+ [&, this]() {
|
|
|
+ _RecordsetPtr rs;
|
|
|
+ rs.CreateInstance(__uuidof(Recordset));
|
|
|
+
|
|
|
+ _variant_t ren = ptrClassic->GetCollect(_T("ren"));
|
|
|
+ _variant_t ren2 = ptrClassic->GetCollect(_T("ren2"));
|
|
|
+
|
|
|
+ if (ren2.vt == VT_NULL || _tcscmp(ren2.bstrVal, _T("")) == 0)
|
|
|
+ {
|
|
|
+ strSql.Format(_T("select User_Name,User_EmployeeID from tb_ErpUser where User_Name = '%s'"), ren.bstrVal);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ strSql.Format(_T("select User_Name,User_EmployeeID from tb_ErpUser where User_Name in ('%s', '%s')"), ren.bstrVal, ren2.bstrVal);
|
|
|
+ }
|
|
|
+
|
|
|
+ hr = rs->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenForwardOnly, adLockReadOnly, adCmdText);
|
|
|
+
|
|
|
+ strSql = _T("");
|
|
|
+ CString strEmployeeId = _T("");
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ while (rs->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ strSql += rs->GetCollect(_T("User_Name")).bstrVal;
|
|
|
+ strSql += _T(",");
|
|
|
+
|
|
|
+ strEmployeeId += rs->GetCollect(_T("User_EmployeeID")).bstrVal;
|
|
|
+ strEmployeeId += _T(",");
|
|
|
+
|
|
|
+ if (_tcscmp(rs->GetCollect(_T("User_Name")).bstrVal, ren.bstrVal) == 0)
|
|
|
+ employeeId = rs->GetCollect(_T("User_EmployeeID"));
|
|
|
+ else if (ren2.vt != VT_NULL && _tcscmp(rs->GetCollect(_T("User_Name")).bstrVal, ren2.bstrVal) == 0)
|
|
|
+ employeeId2 = rs->GetCollect(_T("User_EmployeeID"));
|
|
|
+
|
|
|
+ rs->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ rs->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->PutCollect(_T("Ord_OrderPersonNumber"), _variant_t(strEmployeeId));//订单人员编号,多个用逗号分割
|
|
|
+ ptrPlatinum->PutCollect(_T("Ord_OrderPersonName"), _variant_t(strSql));//订单人员名称,多个用逗号分割
|
|
|
+ }();
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_OldSeriesName"), _T(""));
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_OldSeriesCode"), _T(""));
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_OldSeriesPrice"), _T(""));
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_MicroAppletOrderID"), _T(""));
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_CommissionRatio"), _T(""));//业绩比例
|
|
|
+ //ptrPlatinum->PutCollect(_T("Ord_UploadPath"), _T(""));
|
|
|
+ //ptrPlatinum->PutCollect(_T("ord_AutoColor"), _T(""));
|
|
|
+ ptrPlatinum->Update();
|
|
|
+
|
|
|
+ // 成功插入订单后, 转换其他数据表;
|
|
|
+ // 订单签单人表;
|
|
|
+ c2pOrderSingles(varOrderNumber, employeeId, employeeId2, ptrClassic);
|
|
|
+
|
|
|
+ //if (txtype.vt != VT_NULL && txtype.vt != VT_EMPTY && _tcscmp(txtype.bstrVal, _T("成长套系")) == 0 && Global::g_bChildVersion)
|
|
|
+ if (isChildOrderType(txtype))
|
|
|
+ {
|
|
|
+ // 经典儿童成长套系;
|
|
|
+ // 订单数码表;
|
|
|
+ c2pOrderSubClass(varClassicOrder, varOrderNumber, ptrClassic);
|
|
|
+ // 用户组表;
|
|
|
+ c2pOrderCustomerGroup(varClassicOrder, varOrderNumber, ptrClassic);
|
|
|
+ // 用户组成员表+ 用户表;
|
|
|
+ c2pCustomers(varClassicOrder, ptrClassic);
|
|
|
+ // 订单商品;
|
|
|
+ c2pOrderGoods(varClassicOrder, varOrderNumber, ptrClassic);
|
|
|
+ // 订单收款;
|
|
|
+ c2pRecordOfOrderReceipts(varClassicOrder, varOrderNumber, ptrClassic);
|
|
|
+ // 订单加挑;
|
|
|
+ c2pOrderReceiptsItem(varClassicOrder, varOrderNumber, ptrClassic);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // 订单数码表;
|
|
|
+ c2pOrderDigital(varOrderNumber, ptrClassic);
|
|
|
+ // 数码状态表;
|
|
|
+ c2pOrderDigitalStatus(varOrderNumber, ptrClassic);
|
|
|
+ // 景点表;
|
|
|
+ c2pOrderScenicSpot(varClassicOrder, varOrderNumber, ptrClassic);
|
|
|
+ // 用户组表;
|
|
|
+ c2pOrderCustomerGroup(varClassicOrder, varOrderNumber, ptrClassic);
|
|
|
+ // 用户组成员表+ 用户表;
|
|
|
+ c2pCustomers(varClassicOrder, ptrClassic);
|
|
|
+ // 订单商品;
|
|
|
+ c2pOrderGoods(varClassicOrder, varOrderNumber, ptrClassic);
|
|
|
+ // 订单收款;
|
|
|
+ c2pRecordOfOrderReceipts(varClassicOrder, varOrderNumber, ptrClassic);
|
|
|
+ // 订单加挑;
|
|
|
+ c2pOrderReceiptsItem(varClassicOrder, varOrderNumber, ptrClassic);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 回滚第一条;
|
|
|
+ //ptrPlatinum->MoveFirst();
|
|
|
+ // 下一条;
|
|
|
+ ptrClassic->MoveNext();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrPlatinum->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrClassic->Close();
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d, %s=>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, m_strMsg, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pMemberShip()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ CString strSql = _T("select ")
|
|
|
+ _T("dbo.membermanage.memberno, ")
|
|
|
+ _T("dbo.membermanage.name, ")
|
|
|
+ _T("dbo.membermanage.date,")
|
|
|
+ _T("dbo.membermanage.money, ")
|
|
|
+ _T("dbo.membermanage.autoid,")
|
|
|
+ _T("dbo.membermanage.sex, ")
|
|
|
+ _T("dbo.membermanage.phone, ")
|
|
|
+ _T("dbo.membermanage.qq,")
|
|
|
+ _T("dbo.membermanage.addr, ")
|
|
|
+ _T("dbo.membermanage.occupation,")
|
|
|
+ _T("dbo.membermanage.birthday, ")
|
|
|
+ _T("dbo.membermanage.pinyin, ")
|
|
|
+ _T("dbo.membermanage.balance,")
|
|
|
+ _T("dbo.membermanage.sendmark1, ")
|
|
|
+ _T("dbo.membermanage.sendmark2,")
|
|
|
+ _T("dbo.membermanage.psw, ")
|
|
|
+ _T("dbo.membermanage.cardtype,")
|
|
|
+ _T("dbo.membermanage.check1,")
|
|
|
+ _T("dbo.membermanage.discount, ")
|
|
|
+ _T("isnull((select sum(cast(memberreg3.money as float)) from memberreg3 where memberreg3.memberno = membermanage.memberno),0) as totalMoney ")
|
|
|
+ _T(" from dbo.membermanage ");
|
|
|
+ // membermanage+membercard2副卡=memberview2;//tb_ErpMemberCard//tb_ErpMemberCardViceCard副卡;
|
|
|
+ _RecordsetPtr rsClassicMember;
|
|
|
+ rsClassicMember.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = rsClassicMember->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ _RecordsetPtr rsPlatinumMember;
|
|
|
+ rsPlatinumMember.CreateInstance(__uuidof(Recordset));
|
|
|
+ hr = rsPlatinumMember->Open(_T("select * from tb_ErpMemberCard"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ while (rsClassicMember->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ // 查询顾客ID;
|
|
|
+ _variant_t varCusID = c2pGetCustomerId(rsClassicMember->GetCollect(_T("phone")));
|
|
|
+ if (varCusID.vt == VT_EMPTY || varCusID.vt == VT_NULL)
|
|
|
+ {
|
|
|
+ rsClassicMember->MoveNext();
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // 判断卡号是否存在;
|
|
|
+ strSql.Format(_T("%s%s"), Global::g_szClassicBranchId, rsClassicMember->GetCollect(_T("memberno")).bstrVal);
|
|
|
+ _variant_t varCradNumber = m_strMsg = strSql;
|
|
|
+ strSql.Format(_T("select * from tb_ErpMemberCard where Mc_CradNumber='%s' or Mc_CustomerNumber = '%s'"), varCradNumber.bstrVal, varCusID.bstrVal);
|
|
|
+ _RecordsetPtr result = c2pQueryExspcits(strSql, m_pPlatinumConnection);
|
|
|
+
|
|
|
+#ifdef DEBUG
|
|
|
+
|
|
|
+ if (m_strMsg == _T("JD00085"))
|
|
|
+ {
|
|
|
+ WriteTextLog(_T("c2pMemberShip"));
|
|
|
+ }
|
|
|
+
|
|
|
+#endif // DEBUG
|
|
|
+
|
|
|
+ if (result != NULL && result->adoEOF == VARIANT_TRUE)
|
|
|
+ {
|
|
|
+ _variant_t var = rsClassicMember->GetCollect(_T("phone"));
|
|
|
+
|
|
|
+ if (var.vt == VT_NULL || var.vt == VT_EMPTY || _tcscmp(var.bstrVal, _T("")) == 0)
|
|
|
+ {
|
|
|
+ // 如果电话号码空, 不录入;
|
|
|
+ rsClassicMember->MoveNext();
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ _variant_t varMcNumber;
|
|
|
+ rsPlatinumMember->AddNew();
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ rsPlatinumMember->PutCollect(_T("Mc_DividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ rsPlatinumMember->PutCollect(_T("Mc_Number"), varMcNumber = [&, this]()->_variant_t {
|
|
|
+ TCHAR szUID[24] = { 0 };
|
|
|
+ TCHAR szResult[50] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUID, 24, 10);
|
|
|
+ _stprintf_s(szResult, _T("M%s"), szUID);
|
|
|
+ return szResult;
|
|
|
+ }());
|
|
|
+ rsPlatinumMember->PutCollect(_T("Mc_CradNumber"), varCradNumber);
|
|
|
+ // 查找顾客//如果经典没有电话号码,不录入;
|
|
|
+ strSql.Format(_T("select * from tb_ErpCustomer where Cus_Name ='%s' and Cus_Telephone = '%s' and Cus_Type <> '儿童'"), rsClassicMember->GetCollect(_T("name")).bstrVal, rsClassicMember->GetCollect(_T("phone")).bstrVal);
|
|
|
+ result = c2pQueryExspcits(strSql, m_pPlatinumConnection);
|
|
|
+
|
|
|
+ if (result != NULL && result->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ rsPlatinumMember->PutCollect(_T("Mc_CustomerNumber"), result->GetCollect(_T("Cus_CustomerNumber")));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // 不存在用户记录,新增用户;
|
|
|
+ _variant_t varCustomerId;
|
|
|
+ _RecordsetPtr rsCustomer;
|
|
|
+ rsCustomer.CreateInstance(__uuidof(Recordset));
|
|
|
+ hr = rsCustomer->Open(_T("select * from tb_ErpCustomer"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ // 创建新顾客信息;
|
|
|
+ rsCustomer->AddNew();
|
|
|
+ rsCustomer->PutCollect(_T("Cus_DividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ rsCustomer->PutCollect(_T("Cus_CustomerNumber"), varCustomerId = [&, this]()->_variant_t {
|
|
|
+ TCHAR szUID[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUID, 24, 10);
|
|
|
+ return szUID;
|
|
|
+ }());
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Type"), _T(""));// 成人空;
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Name"), rsClassicMember->GetCollect(_T("name")));
|
|
|
+ // 拼音;
|
|
|
+ rsCustomer->PutCollect(_T("Cus_NamePinyin"), rsClassicMember->GetCollect(_T("pinyin")));
|
|
|
+ // 生日;
|
|
|
+ //DATENULL(rsCustomer, _T("Cus_Birthday"), rsClassicMember->GetCollect(_T("birthday")));
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Birthday"), rsClassicMember->GetCollect(_T("birthday")));
|
|
|
+ _variant_t varCheck = rsClassicMember->GetCollect(_T("check1"));
|
|
|
+
|
|
|
+ if (varCheck.vt == VT_EMPTY || varCheck.vt == VT_NULL || _tcscmp(varCheck.bstrVal, _T("")) == 0)
|
|
|
+ rsCustomer->PutCollect(_T("Cus_BirthdayLunar"), 0);
|
|
|
+ else
|
|
|
+ rsCustomer->PutCollect(_T("Cus_BirthdayLunar"), rsClassicMember->GetCollect(_T("check1")));
|
|
|
+
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Telephone"), rsClassicMember->GetCollect(_T("phone")));
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Sex"), _tcscmp(rsClassicMember->GetCollect(_T("sex")).bstrVal, _T("女")) == 0 ? true : false);
|
|
|
+ DATENULL(rsCustomer, _T("Cus_CreateDateTime"), rsClassicMember->GetCollect(_T("date")));
|
|
|
+ rsCustomer->PutCollect(_T("Cus_QQ"), rsClassicMember->GetCollect(_T("qq")));
|
|
|
+ // 婚期;//Cus_DayForMarriageLunar
|
|
|
+ //DATENULL(rsCustomer, _T("Cus_DayForMarriage"), rsClient->GetCollect(_T("time3")));
|
|
|
+ //rsCustomer->PutCollect(_T("Cus_DayForMarriageLunar"), rsClient->GetCollect(_T("check3")));
|
|
|
+ rsCustomer->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsCustomer->Close();
|
|
|
+
|
|
|
+ rsPlatinumMember->PutCollect(_T("Mc_CustomerNumber"), varCustomerId);
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinumMember->PutCollect(_T("Mc_CardType"), _T("无"));
|
|
|
+ // 历史充值;
|
|
|
+ rsPlatinumMember->PutCollect(_T("Mc_TotalMoney"), rsClassicMember->GetCollect(_T("totalMoney")));
|
|
|
+ // 剩余金额;
|
|
|
+ PRICENULL(rsPlatinumMember, _T("Mc_Money"), rsClassicMember->GetCollect(_T("balance")));
|
|
|
+ // 全部重置成1234;
|
|
|
+ rsPlatinumMember->PutCollect(_T("Mc_TraderPassword"), _T("81dc9bdb52d04dc20036dbd8313ed055"));
|
|
|
+ //rsPlatinumMember->PutCollect(_T("Mc_UsedNumber"), Global::g_szPlatinumBranchId);
|
|
|
+ rsPlatinumMember->PutCollect(_T("Mc_Status"), _T("1"));
|
|
|
+ rsPlatinumMember->PutCollect(_T("Mc_TouchAccount"), 0.0);
|
|
|
+ rsPlatinumMember->PutCollect(_T("Mc_TotalTouchAccount"), 0.0);
|
|
|
+ //rsPlatinumMember->PutCollect(_T("Mc_Remark"), Global::g_szPlatinumBranchId);
|
|
|
+ rsPlatinumMember->PutCollect(_T("Mc_CreateDatetime"), []() ->_variant_t {
|
|
|
+ time_t osBinaryTime;
|
|
|
+ time(&osBinaryTime);
|
|
|
+ COleDateTime time1(osBinaryTime);
|
|
|
+ return time1.m_dt;
|
|
|
+ }());
|
|
|
+ //rsPlatinumMember->PutCollect(_T("Mc_CreateName"), Global::g_szPlatinumBranchId);
|
|
|
+ //rsPlatinumMember->PutCollect(_T("Mc_UpdateDateTime"), Global::g_szPlatinumBranchId);
|
|
|
+ //rsPlatinumMember->PutCollect(_T("Mc_UpdateName"), Global::g_szPlatinumBranchId);
|
|
|
+ //rsPlatinumMember->PutCollect(_T("Mc_OpenCardSource"), Global::g_szPlatinumBranchId);
|
|
|
+ //rsPlatinumMember->PutCollect(_T("Mc_SecondQueryName"), Global::g_szPlatinumBranchId);
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ rsPlatinumMember->Update();
|
|
|
+
|
|
|
+ {
|
|
|
+ // 查找副卡,并添加;
|
|
|
+ //varMcNumber
|
|
|
+ _RecordsetPtr rsSubCard;
|
|
|
+ rsSubCard.CreateInstance(__uuidof(Recordset));
|
|
|
+ strSql.Format(_T("select * from membercard2 where memberno ='%s'"), rsClassicMember->GetCollect(_T("memberno")).bstrVal);
|
|
|
+ hr = rsSubCard->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ while (rsSubCard->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ _RecordsetPtr rsViceCard;
|
|
|
+ rsViceCard.CreateInstance(__uuidof(Recordset));
|
|
|
+ strSql.Format(_T("select * from tb_ErpMemberCardViceCard where Mvc_Number = '%s' and Mvc_ViceCardNumber = '%s'"), varMcNumber.bstrVal, rsSubCard->GetCollect(_T("card2no")).bstrVal);
|
|
|
+ hr = rsViceCard->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ if (rsViceCard->adoEOF == VARIANT_TRUE)
|
|
|
+ {
|
|
|
+ // 不存在,新增;
|
|
|
+ rsViceCard->AddNew();
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ rsViceCard->PutCollect(_T("Mvc_DividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ rsViceCard->PutCollect(_T("Mvc_Number"), varMcNumber);
|
|
|
+ rsViceCard->PutCollect(_T("Mvc_ViceNumber"), [&, this]()->_variant_t {
|
|
|
+ TCHAR szUID[24] = { 0 };
|
|
|
+ TCHAR szResult[50] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUID, 24, 10);
|
|
|
+ _stprintf_s(szResult, _T("V%s"), szUID);
|
|
|
+ return szResult;
|
|
|
+ }());
|
|
|
+ rsViceCard->PutCollect(_T("Mvc_ViceCardNumber"), rsSubCard->GetCollect(_T("card2no")));
|
|
|
+ rsViceCard->PutCollect(_T("Mvc_ViceMoney"), 0);
|
|
|
+ rsViceCard->PutCollect(_T("Mvc_Status"), 1);
|
|
|
+ DATENULL(rsViceCard, _T("Mvc_CreateDatetime"), rsSubCard->GetCollect(_T("date")));
|
|
|
+ rsViceCard->PutCollect(_T("Mvc_CashBackGroup"), 1);
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ rsViceCard->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsViceCard->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 下一条;
|
|
|
+ rsSubCard->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsSubCard->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 下一条;
|
|
|
+ rsClassicMember->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinumMember->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsClassicMember->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d,会员=%s =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, m_strMsg, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pGetClassicPackageType()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // 声明记录集指针;
|
|
|
+ _RecordsetPtr ptrClassic;
|
|
|
+ // 创建实例;
|
|
|
+ ptrClassic.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = ptrClassic->Open(_T("select * from txlb"), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockPessimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ m_listPackageType.clear();
|
|
|
+
|
|
|
+ while (ptrClassic->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ m_listPackageType.push_back(ptrClassic->GetCollect(_T("name")).bstrVal);
|
|
|
+ ptrClassic->MoveNext();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrClassic->Close();
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pCustomerType()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ _RecordsetPtr rsPlatinum;
|
|
|
+ rsPlatinum.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = rsPlatinum->Open(_T("select * from tb_ErpSystemCategory "), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ // AAAAAAL;
|
|
|
+ _variant_t varID = VT_NULL;
|
|
|
+
|
|
|
+ while (rsPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (_tcscmp(rsPlatinum->GetCollect(_T("Sc_ClassCode")).bstrVal, _T("AAAAAAL")) == 0)
|
|
|
+ {
|
|
|
+ varID = rsPlatinum->GetCollect(_T("ID"));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ bool bExsits = false;
|
|
|
+ {
|
|
|
+ //自定义,有些老的数据库可能没有这个表;
|
|
|
+ _RecordsetPtr rs;
|
|
|
+ rs.CreateInstance(__uuidof(Recordset));
|
|
|
+ hr = rs->Open(_T("select * from clienttype"), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ _variant_t varname;
|
|
|
+
|
|
|
+ while (rs->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ bExsits = false;
|
|
|
+ rsPlatinum->MoveFirst();
|
|
|
+ varname = rs->GetCollect(_T("name"));
|
|
|
+
|
|
|
+ while (rsPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (rsPlatinum->GetCollect(_T("Sc_ClassParentID")) == varID && _tcscmp(rsPlatinum->GetCollect(_T("Sc_ClassName")).bstrVal, varname.bstrVal) == 0)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits)
|
|
|
+ {
|
|
|
+ // 添加订单类别: 经典订单;
|
|
|
+ rsPlatinum->AddNew();
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassName"), varname);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassCode"), [this]()->_variant_t {
|
|
|
+ TCHAR szUid[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 24, 10);
|
|
|
+
|
|
|
+ for (int i = 0; i < _tcslen(szUid); i++)
|
|
|
+ {
|
|
|
+ szUid[i] += 17;
|
|
|
+ }
|
|
|
+
|
|
|
+ return szUid;
|
|
|
+ }());
|
|
|
+
|
|
|
+ // 其他非空类;
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsDisable"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsReadOnly"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsEnabledURL"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassParentID"), varID);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_CreateDatetime"), []() ->_variant_t {
|
|
|
+ time_t osBinaryTime;
|
|
|
+ time(&osBinaryTime);
|
|
|
+ COleDateTime time1(osBinaryTime);
|
|
|
+ return time1.m_dt;
|
|
|
+ }());
|
|
|
+
|
|
|
+ rsPlatinum->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ rs->MoveNext();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error& e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pBusinessIntention()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ _RecordsetPtr rsPlatinum;
|
|
|
+ rsPlatinum.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = rsPlatinum->Open(_T("select * from tb_ErpSystemCategory "), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ // AAAAAAL;
|
|
|
+ _variant_t varID = VT_NULL;
|
|
|
+
|
|
|
+ while (rsPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (_tcscmp(rsPlatinum->GetCollect(_T("Sc_ClassCode")).bstrVal, _T("AAAAAAO")) == 0)
|
|
|
+ {
|
|
|
+ varID = rsPlatinum->GetCollect(_T("ID"));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ bool bExsits = false;
|
|
|
+ {
|
|
|
+ //自定义,有些老的数据库可能没有这个表;
|
|
|
+ _RecordsetPtr rs;
|
|
|
+ rs.CreateInstance(__uuidof(Recordset));
|
|
|
+ hr = rs->Open(_T("select * from businessintention"), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ _variant_t varname;
|
|
|
+
|
|
|
+ while (rs->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ bExsits = false;
|
|
|
+ rsPlatinum->MoveFirst();
|
|
|
+ varname = rs->GetCollect(_T("name"));
|
|
|
+
|
|
|
+ while (rsPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (rsPlatinum->GetCollect(_T("Sc_ClassParentID")) == varID && _tcscmp(rsPlatinum->GetCollect(_T("Sc_ClassName")).bstrVal, varname.bstrVal) == 0)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits)
|
|
|
+ {
|
|
|
+ // 添加订单类别: 经典订单;
|
|
|
+ rsPlatinum->AddNew();
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassName"), varname);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassCode"), [this]()->_variant_t {
|
|
|
+ TCHAR szUid[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 24, 10);
|
|
|
+
|
|
|
+ for (int i = 0; i < _tcslen(szUid); i++)
|
|
|
+ {
|
|
|
+ szUid[i] += 17;
|
|
|
+ }
|
|
|
+
|
|
|
+ return szUid;
|
|
|
+ }());
|
|
|
+
|
|
|
+ // 其他非空类;
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsDisable"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsReadOnly"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsEnabledURL"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassParentID"), varID);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_CreateDatetime"), []() ->_variant_t {
|
|
|
+ time_t osBinaryTime;
|
|
|
+ time(&osBinaryTime);
|
|
|
+ COleDateTime time1(osBinaryTime);
|
|
|
+ return time1.m_dt;
|
|
|
+ }());
|
|
|
+
|
|
|
+ rsPlatinum->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ rs->MoveNext();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error& e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pHostpital()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ _RecordsetPtr rsPlatinum;
|
|
|
+ rsPlatinum.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = rsPlatinum->Open(_T("select * from tb_ErpSystemCategory "), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ // AAAAAAL;
|
|
|
+ _variant_t varID = VT_NULL;
|
|
|
+
|
|
|
+ while (rsPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (_tcscmp(rsPlatinum->GetCollect(_T("Sc_ClassCode")).bstrVal, _T("AAAAAAK")) == 0)
|
|
|
+ {
|
|
|
+ varID = rsPlatinum->GetCollect(_T("ID"));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ bool bExsits = false;
|
|
|
+ {
|
|
|
+ //自定义,有些老的数据库可能没有这个表;
|
|
|
+ _RecordsetPtr rs;
|
|
|
+ rs.CreateInstance(__uuidof(Recordset));
|
|
|
+ hr = rs->Open(_T("select * from hospital"), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ _variant_t varname;
|
|
|
+
|
|
|
+ while (rs->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ bExsits = false;
|
|
|
+ rsPlatinum->MoveFirst();
|
|
|
+ varname = rs->GetCollect(_T("name"));
|
|
|
+
|
|
|
+ while (rsPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (rsPlatinum->GetCollect(_T("Sc_ClassParentID")) == varID && _tcscmp(rsPlatinum->GetCollect(_T("Sc_ClassName")).bstrVal, varname.bstrVal) == 0)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits)
|
|
|
+ {
|
|
|
+ // 添加订单类别: 经典订单;
|
|
|
+ rsPlatinum->AddNew();
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassName"), varname);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassCode"), [this]()->_variant_t {
|
|
|
+ TCHAR szUid[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 24, 10);
|
|
|
+
|
|
|
+ for (int i = 0; i < _tcslen(szUid); i++)
|
|
|
+ {
|
|
|
+ szUid[i] += 17;
|
|
|
+ }
|
|
|
+
|
|
|
+ return szUid;
|
|
|
+ }());
|
|
|
+
|
|
|
+ // 其他非空类;
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsDisable"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsReadOnly"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsEnabledURL"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassParentID"), varID);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_CreateDatetime"), []() ->_variant_t {
|
|
|
+ time_t osBinaryTime;
|
|
|
+ time(&osBinaryTime);
|
|
|
+ COleDateTime time1(osBinaryTime);
|
|
|
+ return time1.m_dt;
|
|
|
+ }());
|
|
|
+
|
|
|
+ rsPlatinum->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ rs->MoveNext();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error& e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pBusinessTypes()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ _RecordsetPtr rsPlatinum;
|
|
|
+ rsPlatinum.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = rsPlatinum->Open(_T("select * from tb_ErpSystemCategory "), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ // AAAAAAL;
|
|
|
+ _variant_t varID = VT_NULL;
|
|
|
+
|
|
|
+ while (rsPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (_tcscmp(rsPlatinum->GetCollect(_T("Sc_ClassCode")).bstrVal, _T("AAAAAAM")) == 0)
|
|
|
+ {
|
|
|
+ varID = rsPlatinum->GetCollect(_T("ID"));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ bool bExsits = false;
|
|
|
+ {
|
|
|
+ //自定义,有些老的数据库可能没有这个表;
|
|
|
+ _RecordsetPtr rs;
|
|
|
+ rs.CreateInstance(__uuidof(Recordset));
|
|
|
+ hr = rs->Open(_T("select * from businesstype"), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ _variant_t varname;
|
|
|
+
|
|
|
+ while (rs->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ bExsits = false;
|
|
|
+ rsPlatinum->MoveFirst();
|
|
|
+ varname = rs->GetCollect(_T("name"));
|
|
|
+
|
|
|
+ while (rsPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (rsPlatinum->GetCollect(_T("Sc_ClassParentID")) == varID && _tcscmp(rsPlatinum->GetCollect(_T("Sc_ClassName")).bstrVal, varname.bstrVal) == 0)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits)
|
|
|
+ {
|
|
|
+ // 添加订单类别: 经典订单;
|
|
|
+ rsPlatinum->AddNew();
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassName"), varname);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassCode"), [this]()->_variant_t {
|
|
|
+ TCHAR szUid[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 24, 10);
|
|
|
+
|
|
|
+ for (int i = 0; i < _tcslen(szUid); i++)
|
|
|
+ {
|
|
|
+ szUid[i] += 17;
|
|
|
+ }
|
|
|
+
|
|
|
+ return szUid;
|
|
|
+ }());
|
|
|
+
|
|
|
+ // 其他非空类;
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsDisable"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsReadOnly"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsEnabledURL"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassParentID"), varID);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_CreateDatetime"), []() ->_variant_t {
|
|
|
+ time_t osBinaryTime;
|
|
|
+ time(&osBinaryTime);
|
|
|
+ COleDateTime time1(osBinaryTime);
|
|
|
+ return time1.m_dt;
|
|
|
+ }());
|
|
|
+
|
|
|
+ rsPlatinum->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ rs->MoveNext();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error& e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pFeedingMode()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ _RecordsetPtr rsPlatinum;
|
|
|
+ rsPlatinum.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = rsPlatinum->Open(_T("select * from tb_ErpSystemCategory "), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ // AAAAAAL;
|
|
|
+ _variant_t varID = VT_NULL;
|
|
|
+
|
|
|
+ while (rsPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (_tcscmp(rsPlatinum->GetCollect(_T("Sc_ClassCode")).bstrVal, _T("AAAAAAN")) == 0)
|
|
|
+ {
|
|
|
+ varID = rsPlatinum->GetCollect(_T("ID"));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ bool bExsits = false;
|
|
|
+ {
|
|
|
+ //混合
|
|
|
+ rsPlatinum->MoveFirst();
|
|
|
+
|
|
|
+ while (rsPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (rsPlatinum->GetCollect(_T("Sc_ClassParentID")) == varID && _tcscmp(rsPlatinum->GetCollect(_T("Sc_ClassName")).bstrVal, _T("混合")) == 0)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits)
|
|
|
+ {
|
|
|
+ // 添加订单类别: 经典订单;
|
|
|
+ rsPlatinum->AddNew();
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassName"), _T("混合"));
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassCode"), [this]()->_variant_t {
|
|
|
+ TCHAR szUid[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 24, 10);
|
|
|
+
|
|
|
+ for (int i = 0; i < _tcslen(szUid); i++)
|
|
|
+ {
|
|
|
+ szUid[i] += 17;
|
|
|
+ }
|
|
|
+
|
|
|
+ return szUid;
|
|
|
+ }());
|
|
|
+
|
|
|
+ // 其他非空类;
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsDisable"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsReadOnly"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsEnabledURL"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassParentID"), varID);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_CreateDatetime"), []() ->_variant_t {
|
|
|
+ time_t osBinaryTime;
|
|
|
+ time(&osBinaryTime);
|
|
|
+ COleDateTime time1(osBinaryTime);
|
|
|
+ return time1.m_dt;
|
|
|
+ }());
|
|
|
+
|
|
|
+ rsPlatinum->Update();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ {
|
|
|
+ //母乳
|
|
|
+ bExsits = false;
|
|
|
+ rsPlatinum->MoveFirst();
|
|
|
+
|
|
|
+ while (rsPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (rsPlatinum->GetCollect(_T("Sc_ClassParentID")) == varID && _tcscmp(rsPlatinum->GetCollect(_T("Sc_ClassName")).bstrVal, _T("母乳")) == 0)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits)
|
|
|
+ {
|
|
|
+ // 添加订单类别: 经典订单;
|
|
|
+ rsPlatinum->AddNew();
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassName"), _T("母乳"));
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassCode"), [this]()->_variant_t {
|
|
|
+ TCHAR szUid[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 24, 10);
|
|
|
+
|
|
|
+ for (int i = 0; i < _tcslen(szUid); i++)
|
|
|
+ {
|
|
|
+ szUid[i] += 17;
|
|
|
+ }
|
|
|
+
|
|
|
+ return szUid;
|
|
|
+ }());
|
|
|
+
|
|
|
+ // 其他非空类;
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsDisable"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsReadOnly"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsEnabledURL"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassParentID"), varID);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_CreateDatetime"), []() ->_variant_t {
|
|
|
+ time_t osBinaryTime;
|
|
|
+ time(&osBinaryTime);
|
|
|
+ COleDateTime time1(osBinaryTime);
|
|
|
+ return time1.m_dt;
|
|
|
+ }());
|
|
|
+
|
|
|
+ rsPlatinum->Update();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ {
|
|
|
+ //人工
|
|
|
+ bExsits = false;
|
|
|
+ rsPlatinum->MoveFirst();
|
|
|
+
|
|
|
+ while (rsPlatinum->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (rsPlatinum->GetCollect(_T("Sc_ClassParentID")) == varID && _tcscmp(rsPlatinum->GetCollect(_T("Sc_ClassName")).bstrVal, _T("人工")) == 0)
|
|
|
+ {
|
|
|
+ bExsits = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!bExsits)
|
|
|
+ {
|
|
|
+ // 添加订单类别: 经典订单;
|
|
|
+ rsPlatinum->AddNew();
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassName"), _T("人工"));
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassCode"), [this]()->_variant_t {
|
|
|
+ TCHAR szUid[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUid, 24, 10);
|
|
|
+
|
|
|
+ for (int i = 0; i < _tcslen(szUid); i++)
|
|
|
+ {
|
|
|
+ szUid[i] += 17;
|
|
|
+ }
|
|
|
+
|
|
|
+ return szUid;
|
|
|
+ }());
|
|
|
+
|
|
|
+ // 其他非空类;
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsDisable"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsReadOnly"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_IsEnabledURL"), false);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_ClassParentID"), varID);
|
|
|
+ rsPlatinum->PutCollect(_T("Sc_CreateDatetime"), []() ->_variant_t {
|
|
|
+ time_t osBinaryTime;
|
|
|
+ time(&osBinaryTime);
|
|
|
+ COleDateTime time1(osBinaryTime);
|
|
|
+ return time1.m_dt;
|
|
|
+ }());
|
|
|
+
|
|
|
+ rsPlatinum->Update();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error& e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pHospitalCustomer()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ //hospitalclient;tb_ErpHospitalClient
|
|
|
+ CString strSql;
|
|
|
+ _RecordsetPtr rsClassic;
|
|
|
+ rsClassic.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = rsClassic->Open(_T("select * from hospitalclient"), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ _RecordsetPtr rsPlatinum;
|
|
|
+ rsPlatinum.CreateInstance(__uuidof(Recordset));
|
|
|
+ hr = rsPlatinum->Open(_T("select * from tb_ErpHospitalClient"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ m_dwIndex = 0;
|
|
|
+
|
|
|
+ while (rsClassic->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ m_dwIndex++;
|
|
|
+#ifdef _DEBUG
|
|
|
+
|
|
|
+ if (m_dwIndex == 0)
|
|
|
+ {
|
|
|
+ WriteTextLog(_T("c2pHospitalCustomer"));
|
|
|
+ }
|
|
|
+
|
|
|
+#endif
|
|
|
+ // 判断是否存在;
|
|
|
+ _variant_t varHostpitalOrder;
|
|
|
+ strSql.Format(_T("%s%s"), Global::g_szClassicBranchId, rsClassic->GetCollect(_T("id")).bstrVal);
|
|
|
+ varHostpitalOrder = strSql;
|
|
|
+
|
|
|
+ strSql.Format(_T("select * from tb_ErpHospitalClient where Hct_Oddnumber = '%s'"), varHostpitalOrder.bstrVal);
|
|
|
+ _RecordsetPtr result = c2pQueryExspcits(strSql, m_pPlatinumConnection);
|
|
|
+
|
|
|
+ if (result != NULL && result->adoEOF == VARIANT_TRUE)
|
|
|
+ {
|
|
|
+ // 不存在订单,添加;
|
|
|
+ rsPlatinum->AddNew();
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_DividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_Oddnumber"), varHostpitalOrder);
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_CustomerName"), rsClassic->GetCollect(_T("name1")));
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_BabyName"), rsClassic->GetCollect(_T("name2")));
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_BabySex"), rsClassic->GetCollect(_T("sex")));
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_BabyBirthday"), rsClassic->GetCollect(_T("birthday")));
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_AreLunar"), rsClassic->GetCollect(_T("check1")));
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_BirthdayType"), rsClassic->GetCollect(_T("birthdaytype")));
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_MessageSingle"), rsClassic->GetCollect(_T("checkmsg")));
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_CustomerOrders"), 0);
|
|
|
+ //rsPlatinum->PutCollect(_T("Hct_OrderNumber"), rsClassic->GetCollect(_T("id")));
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_BabyFeeding"), rsClassic->GetCollect(_T("food")));
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_CustomerRegions"), rsClassic->GetCollect(_T("from")));
|
|
|
+ //rsPlatinum->PutCollect(_T("Hct_CustomerGroups"), rsClassic->GetCollect(_T("id")));
|
|
|
+ //rsPlatinum->PutCollect(_T("Hct_DealStatus"), rsClassic->GetCollect(_T("id")));//成交状态
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_SingleHospital"), rsClassic->GetCollect(_T("hospital")));
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_MyselfMobile"), rsClassic->GetCollect(_T("phone1")));
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_HusbandMobile"), rsClassic->GetCollect(_T("phone2")));
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_FamilyPhone"), rsClassic->GetCollect(_T("phone3")));
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_Husbandphone"), rsClassic->GetCollect(_T("phone4")));
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_Maidenphone"), rsClassic->GetCollect(_T("phone5")));
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_QQ"), rsClassic->GetCollect(_T("qq")));
|
|
|
+ _variant_t varDays = rsClassic->GetCollect(_T("pregnancydays"));
|
|
|
+
|
|
|
+ if (varDays.vt == VT_EMPTY || varDays.vt == VT_NULL || _tcscmp(varDays.bstrVal, _T("")) == 0)
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_PregnantDay"), 0);
|
|
|
+ else
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_PregnantDay"), _ttoi(varDays.bstrVal));
|
|
|
+
|
|
|
+ // 门市;
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_Retail"), rsClassic->GetCollect(_T("clerk")));
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_Remarks"), rsClassic->GetCollect(_T("remark")));
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_HomeAddress"), rsClassic->GetCollect(_T("addr1")));
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_HomePostcode"), rsClassic->GetCollect(_T("post1")));
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_HusbandAddress"), rsClassic->GetCollect(_T("addr2")));
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_HusbandPostcode"), rsClassic->GetCollect(_T("post2")));
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_MaidenAddress"), rsClassic->GetCollect(_T("addr3")));
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_MaidenPostcode"), rsClassic->GetCollect(_T("post3")));
|
|
|
+ // 签单日期;
|
|
|
+ //rsPlatinum->PutCollect(_T("Hct_SingleDatetime"), rsClassic->GetCollect(_T("date1")));
|
|
|
+ DATENULL(rsPlatinum, _T("Hct_SingleDatetime"), rsClassic->GetCollect(_T("date1")));
|
|
|
+ rsPlatinum->PutCollect(_T("Hcr_BusinessType"), rsClassic->GetCollect(_T("type")));
|
|
|
+ //rsPlatinum->PutCollect(_T("Hct_BusinessIntention"), rsClassic->GetCollect(_T("id")));
|
|
|
+ //rsPlatinum->PutCollect(_T("Hct_CreateDatetime"), rsClassic->GetCollect(_T("inputdate")));
|
|
|
+ DATENULL(rsPlatinum, _T("Hct_CreateDatetime"), rsClassic->GetCollect(_T("inputdate")));
|
|
|
+ rsPlatinum->PutCollect(_T("Hct_CreateName"), rsClassic->GetCollect(_T("inputer")));
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ rsPlatinum->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsClassic->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPlatinum->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsClassic->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d,%ld =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, m_dwIndex, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pOrderSelection(bool bImg, CString strOrder)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ CString strSql;
|
|
|
+ _RecordsetPtr rsdindan;
|
|
|
+ rsdindan.CreateInstance(__uuidof(Recordset));
|
|
|
+ if (strOrder.IsEmpty())
|
|
|
+ strSql = _T("select * from dindan");
|
|
|
+ else
|
|
|
+ strSql.Format(_T("select * from dindan where id = '%s'"), strOrder);
|
|
|
+ HRESULT hr = rsdindan->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ CString strResult;
|
|
|
+ _variant_t varNo, varNo2, varspid, varOrder, varDelphotos, varDelphotos2, varbz3;
|
|
|
+
|
|
|
+ while (rsdindan->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ _variant_t varStatus = rsdindan->GetCollect(_T("c2p_status"));
|
|
|
+
|
|
|
+ if (varStatus.vt == VT_EMPTY || varStatus.vt == VT_NULL || varStatus.intVal != 1)
|
|
|
+ {
|
|
|
+ c2pSelection c2pslt;
|
|
|
+ c2pslt.strOrder = rsdindan->GetCollect(_T("id")).bstrVal;
|
|
|
+ _variant_t del = rsdindan->GetCollect(_T("delphotos"));
|
|
|
+ _variant_t del2 = rsdindan->GetCollect(_T("delphotos2"));
|
|
|
+ _variant_t bz2 = rsdindan->GetCollect(_T("bz2"));
|
|
|
+ _variant_t bz3 = rsdindan->GetCollect(_T("bz3"));
|
|
|
+ _variant_t bz4 = rsdindan->GetCollect(_T("bz4"));
|
|
|
+ _variant_t bz5 = rsdindan->GetCollect(_T("bz5"));
|
|
|
+
|
|
|
+ if (del.vt == VT_EMPTY || del.vt == VT_NULL)
|
|
|
+ c2pslt.strDelphotos = _T("");
|
|
|
+ else
|
|
|
+ c2pslt.strDelphotos = del.bstrVal;
|
|
|
+
|
|
|
+ if (del2.vt == VT_EMPTY || del2.vt == VT_NULL)
|
|
|
+ c2pslt.strDelphotos2 = _T("");
|
|
|
+ else
|
|
|
+ c2pslt.strDelphotos2 = del2.bstrVal;
|
|
|
+
|
|
|
+ if (bz2.vt == VT_EMPTY || bz2.vt == VT_NULL)
|
|
|
+ c2pslt.strbz2 = _T("");
|
|
|
+ else
|
|
|
+ c2pslt.strbz2 = bz2.bstrVal;
|
|
|
+
|
|
|
+ if (bz3.vt == VT_EMPTY || bz3.vt == VT_NULL)
|
|
|
+ c2pslt.strbz3 = _T("");
|
|
|
+ else
|
|
|
+ c2pslt.strbz3 = bz3.bstrVal;
|
|
|
+
|
|
|
+ if (bz4.vt == VT_EMPTY || bz4.vt == VT_NULL)
|
|
|
+ c2pslt.strbz4 = _T("");
|
|
|
+ else
|
|
|
+ c2pslt.strbz4 = bz4.bstrVal;
|
|
|
+
|
|
|
+ if (bz5.vt == VT_EMPTY || bz5.vt == VT_NULL)
|
|
|
+ c2pslt.strbz5 = _T("");
|
|
|
+ else
|
|
|
+ c2pslt.strbz5 = bz5.bstrVal;
|
|
|
+
|
|
|
+ m_strMsg = c2pslt.strOrder;
|
|
|
+#ifdef _DEBUG
|
|
|
+
|
|
|
+ if (m_strMsg == _T("ZPQ002"))
|
|
|
+ {
|
|
|
+ WriteTextLog(_T("c2pOrderSelection"));
|
|
|
+ }
|
|
|
+
|
|
|
+#endif
|
|
|
+ _RecordsetPtr rsdindansp;
|
|
|
+ rsdindansp.CreateInstance(__uuidof(Recordset));
|
|
|
+ strSql.Format(_T("select * from dindansp where id = '%s'"), rsdindan->GetCollect(_T("id")).bstrVal);
|
|
|
+ hr = rsdindansp->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ while (rsdindansp->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ c2pSelectionItem c2pslti;
|
|
|
+ c2pslti.strSpId = rsdindansp->GetCollect(_T("spid")).bstrVal;
|
|
|
+ c2pslti.strSpName = rsdindansp->GetCollect(_T("name")).bstrVal;
|
|
|
+ _variant_t no = rsdindansp->GetCollect(_T("no"));
|
|
|
+ _variant_t no2 = rsdindansp->GetCollect(_T("no2"));
|
|
|
+
|
|
|
+ if (no.vt == VT_EMPTY || no.vt == VT_NULL)
|
|
|
+ c2pslti.strNo = _T("");
|
|
|
+ else
|
|
|
+ c2pslti.strNo = no.bstrVal;
|
|
|
+
|
|
|
+ if (no2.vt == VT_EMPTY || no2.vt == VT_NULL)
|
|
|
+ c2pslti.strNo2 = _T("");
|
|
|
+ else
|
|
|
+ c2pslti.strNo2 = no2.bstrVal;
|
|
|
+
|
|
|
+ c2pslt.vtItems.push_back(c2pslti);
|
|
|
+
|
|
|
+ rsdindansp->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsdindansp->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 转换选片数据;
|
|
|
+ c2pOrderSelection(c2pslt);
|
|
|
+
|
|
|
+ // 复制相片到目标路径, 并修改相片名称;
|
|
|
+ if (bImg)
|
|
|
+ {
|
|
|
+ c2pOrderImg(c2pslt.strOrder);
|
|
|
+ // 成功后, 设置c2p_status=1;
|
|
|
+ rsdindan->PutCollect(_T("c2p_status"), 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ rsdindan->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsdindan->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsdindan->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d,%s =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, m_strMsg, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+bool c2p::c2pResetImgConvert()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ if (m_pClassicConnection == NULL)
|
|
|
+ return false;
|
|
|
+
|
|
|
+ CString strSql;
|
|
|
+ _CommandPtr pCommand;
|
|
|
+ pCommand.CreateInstance(__uuidof(Command));
|
|
|
+ pCommand->ActiveConnection = m_pClassicConnection;
|
|
|
+ pCommand->CommandTimeout = 120;
|
|
|
+ pCommand->CommandText = _T("update dindan set c2p_status = 0");
|
|
|
+ pCommand->Execute(NULL, NULL, adCmdText);
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pResetOrderPerson()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ CString strSql;
|
|
|
+ _CommandPtr pCommand;
|
|
|
+ pCommand.CreateInstance(__uuidof(Command));
|
|
|
+ pCommand->ActiveConnection = m_pPlatinumConnection;
|
|
|
+ pCommand->CommandTimeout = 120;
|
|
|
+ strSql.Format(_T("delete from [tb_ErpOrdersPerson] where [OrdPe_OrderNumber] like '%s%%'"), Global::g_szClassicBranchId);
|
|
|
+ pCommand->CommandText = _bstr_t(strSql);
|
|
|
+ pCommand->Execute(NULL, NULL, adCmdText);
|
|
|
+
|
|
|
+ _RecordsetPtr rsdindan;
|
|
|
+ rsdindan.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = rsdindan->Open(_T("select id, ren, ren2,time1 from dindan"), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ while (rsdindan->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ // 判断铂金订单号是否存在;
|
|
|
+ _variant_t varClassicOrder = rsdindan->GetCollect(_T("id"));
|
|
|
+ strSql.Format(_T("%s%s"), Global::g_szClassicBranchId, varClassicOrder.bstrVal);
|
|
|
+ _variant_t varOrderNumber = strSql;
|
|
|
+
|
|
|
+ // 主副门市;
|
|
|
+ _variant_t employeeId;
|
|
|
+ _variant_t employeeId2;
|
|
|
+ [&, this]() {
|
|
|
+ _RecordsetPtr rs;
|
|
|
+ rs.CreateInstance(__uuidof(Recordset));
|
|
|
+
|
|
|
+ _variant_t ren = rsdindan->GetCollect(_T("ren"));
|
|
|
+ _variant_t ren2 = rsdindan->GetCollect(_T("ren2"));
|
|
|
+
|
|
|
+ if (ren2.vt == VT_NULL || ren2.vt == VT_EMPTY || _tcscmp(ren2.bstrVal, _T("")) == 0)
|
|
|
+ {
|
|
|
+ strSql.Format(_T("select User_Name,User_EmployeeID from tb_ErpUser where User_Name = '%s'"), ren.bstrVal);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ strSql.Format(_T("select User_Name,User_EmployeeID from tb_ErpUser where User_Name in ('%s', '%s')"), ren.bstrVal, ren2.bstrVal);
|
|
|
+ }
|
|
|
+
|
|
|
+ hr = rs->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenForwardOnly, adLockReadOnly, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ while (rs->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (_tcscmp(rs->GetCollect(_T("User_Name")).bstrVal, ren.bstrVal) == 0)
|
|
|
+ employeeId = rs->GetCollect(_T("User_EmployeeID"));
|
|
|
+ else if (ren2.vt != VT_NULL && ren2.vt != VT_EMPTY && _tcscmp(rs->GetCollect(_T("User_Name")).bstrVal, ren2.bstrVal) == 0)
|
|
|
+ employeeId2 = rs->GetCollect(_T("User_EmployeeID"));
|
|
|
+
|
|
|
+ rs->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ rs->Close();
|
|
|
+ }
|
|
|
+ }();
|
|
|
+
|
|
|
+ // 订单签单人表;
|
|
|
+ c2pOrderSingles(varOrderNumber, employeeId, employeeId2, rsdindan);
|
|
|
+
|
|
|
+ rsdindan->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsdindan->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pResetOrderScenicSpot()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ CString strSql;
|
|
|
+ _CommandPtr pCommand;
|
|
|
+ pCommand.CreateInstance(__uuidof(Command));
|
|
|
+ pCommand->ActiveConnection = m_pPlatinumConnection;
|
|
|
+ pCommand->CommandTimeout = 120;
|
|
|
+ strSql.Format(_T("delete from [tb_ErpOrdersPhotography] where [Ordpg_Number] like '%s%%'"), Global::g_szClassicBranchId);
|
|
|
+ pCommand->CommandText = _bstr_t(strSql);
|
|
|
+ pCommand->Execute(NULL, NULL, adCmdText);
|
|
|
+
|
|
|
+ _RecordsetPtr rsdindan;
|
|
|
+ rsdindan.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = rsdindan->Open(_T("select * from dindan"), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockReadOnly, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ while (rsdindan->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ _variant_t id = rsdindan->GetCollect(_T("id"));
|
|
|
+ strSql.Format(_T("%s%s"), Global::g_szClassicBranchId, id.bstrVal);
|
|
|
+ _variant_t order = strSql;
|
|
|
+ _variant_t txtype = rsdindan->GetCollect(_T("txtype"));
|
|
|
+
|
|
|
+ if (txtype.vt != VT_NULL && txtype.vt != VT_EMPTY && _tcscmp(txtype.bstrVal, _T("成长套系")) == 0 && Global::g_bChildVersion)
|
|
|
+ {
|
|
|
+ // 经典儿童成长套系;
|
|
|
+ // 订单数码表;
|
|
|
+ CString strSql;
|
|
|
+ _RecordsetPtr rsdindanjd;
|
|
|
+ rsdindanjd.CreateInstance(__uuidof(Recordset));
|
|
|
+ strSql.Format(_T("select * from dindanjd where id = '%s'"), id.bstrVal);
|
|
|
+ HRESULT hr = rsdindanjd->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockReadOnly, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ int nSubId = 1;
|
|
|
+
|
|
|
+ while (rsdindanjd->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ // 生成子单;
|
|
|
+ _variant_t varSubId = [&, this]()->_variant_t {
|
|
|
+ TCHAR szSubID[50] = { 0 };
|
|
|
+ _stprintf_s(szSubID, _T("%s_%03d"), order.bstrVal, nSubId);
|
|
|
+ return szSubID;
|
|
|
+ }();
|
|
|
+
|
|
|
+ // 子单化景点;
|
|
|
+ c2pSubOrderScenicSpot(varSubId, id, order, rsdindanjd, rsdindan);
|
|
|
+
|
|
|
+ nSubId++;
|
|
|
+ rsdindanjd->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsdindanjd->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // 景点表;
|
|
|
+ c2pOrderScenicSpot(id, order, rsdindan);
|
|
|
+ }
|
|
|
+
|
|
|
+ rsdindan->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsdindan->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pResetOrderScenicSpot2()
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ CString strSql;
|
|
|
+ _RecordsetPtr rsdindan;
|
|
|
+ rsdindan.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = rsdindan->Open(_T("select * from dindan"), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockReadOnly, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ while (rsdindan->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ // 经典订单号;
|
|
|
+ _variant_t id = rsdindan->GetCollect(_T("id"));
|
|
|
+ // 套系;
|
|
|
+ _variant_t txtype = rsdindan->GetCollect(_T("txtype"));
|
|
|
+ // 铂金订单号;
|
|
|
+ strSql.Format(_T("%s%s"), Global::g_szClassicBranchId, id.bstrVal);
|
|
|
+ _variant_t order = strSql;
|
|
|
+ _RecordsetPtr rsdindanjd;
|
|
|
+ rsdindanjd.CreateInstance(__uuidof(Recordset));
|
|
|
+ strSql.Format(_T("select * from dindanjd where id = '%s'"), id.bstrVal);
|
|
|
+ HRESULT hr = rsdindanjd->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockReadOnly, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ while (rsdindanjd->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ _variant_t varScenicSpot = rsdindanjd->GetCollect(_T("name"));
|
|
|
+ _RecordsetPtr rsPhotography;
|
|
|
+ rsPhotography.CreateInstance(__uuidof(Recordset));
|
|
|
+ strSql.Format(_T("select * from tb_ErpOrdersPhotography where Ordpg_Number = '%s' and Ordpg_Sights = '%s'"), order.bstrVal, varScenicSpot.bstrVal);
|
|
|
+ hr = rsPhotography->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ if (rsPhotography->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ rsPhotography->PutCollect(_T("Ordpg_ReservationPhotographyDividedShop"), Global::g_szPlatinumBranchId);//预约分店;
|
|
|
+ rsPhotography->PutCollect(_T("Ordpg_ReservationPhotographyName"), c2pGetEmployeeId(rsdindanjd->GetCollect(_T("waiter1"))));//预约摄影师;
|
|
|
+ rsPhotography->PutCollect(_T("Ordpg_ReservationPhotographyAssistant"), c2pGetEmployeeId(rsdindanjd->GetCollect(_T("waiter12"))));//预约摄影师助理;
|
|
|
+
|
|
|
+ if (Global::g_bChildVersion)
|
|
|
+ {
|
|
|
+ rsPhotography->PutCollect(_T("Ordpg_ReservationBootDivision"), c2pGetEmployeeId(rsdindanjd->GetCollect(_T("waiter2"))));//预约引导师;
|
|
|
+ rsPhotography->PutCollect(_T("Ordpg_ReservationBootDivisionAssistant"), c2pGetEmployeeId(rsdindanjd->GetCollect(_T("waiter22"))));//预约引导师助理;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ rsPhotography->PutCollect(_T("Ordpg_ReservationMakeupArtist"), c2pGetEmployeeId(rsdindanjd->GetCollect(_T("waiter2"))));//预约化妆师;
|
|
|
+ rsPhotography->PutCollect(_T("Ordpg_ReservationMakeupAssistant"), c2pGetEmployeeId(rsdindanjd->GetCollect(_T("waiter22"))));//预约化妆师助理;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPhotography->Update();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // 暂时不处理;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsPhotography->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsdindanjd->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsdindanjd->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsdindan->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsdindan->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pOnlyConvertImg(CString strOrders)
|
|
|
+{
|
|
|
+ if (strOrders.IsEmpty())
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ CString strSql;
|
|
|
+ _RecordsetPtr rsdindan;
|
|
|
+ rsdindan.CreateInstance(__uuidof(Recordset));
|
|
|
+ HRESULT hr = rsdindan->Open(_T("select id from dindan"), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ while (rsdindan->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ c2pOrderImg(rsdindan->GetCollect(_T("id")).bstrVal);
|
|
|
+ rsdindan->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsdindan->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d,%s =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, m_strMsg, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CString strId;
|
|
|
+ strOrders.TrimRight(_T(","));
|
|
|
+ strOrders += _T(",");
|
|
|
+ int nIndex = strOrders.Find(_T(","));
|
|
|
+ WriteTextLog(strOrders);
|
|
|
+
|
|
|
+ do
|
|
|
+ {
|
|
|
+ nIndex = strOrders.Find(_T(","));
|
|
|
+
|
|
|
+ if (nIndex != -1)
|
|
|
+ {
|
|
|
+ strId = strOrders.Left(nIndex);
|
|
|
+ strOrders.Delete(0, nIndex + 1);
|
|
|
+ c2pOrderImg(strId);
|
|
|
+ }
|
|
|
+ } while (nIndex != -1);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pRepairCustomer(CString strOrder)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ CString strSql;
|
|
|
+ _RecordsetPtr rsclient;
|
|
|
+ rsclient.CreateInstance(__uuidof(Recordset));
|
|
|
+ if (strOrder.IsEmpty())
|
|
|
+ strSql = _T("select client.*, dindan.pinyin1, dindan.pinyin2,dindan.time1 from client inner join dindan on client.id = dindan.id");
|
|
|
+ else
|
|
|
+ strSql.Format(_T("select client.*, dindan.pinyin1, dindan.pinyin2,dindan.time1 from client inner join dindan on client.id = dindan.id where dindan.id = '%s'"), strOrder);
|
|
|
+
|
|
|
+ HRESULT hr = rsclient->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pClassicConnection, true), adOpenDynamic, adLockReadOnly, adCmdText);
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ while (rsclient->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ _variant_t varCustomerId;
|
|
|
+ _variant_t varCustomerId2;
|
|
|
+ _variant_t name1 = rsclient->GetCollect(_T("name1"));
|
|
|
+ _variant_t name2 = rsclient->GetCollect(_T("name2"));
|
|
|
+ _variant_t varGroupId = c2pGetGroupId(rsclient->GetCollect(_T("id")));
|
|
|
+ if (varGroupId.vt != VT_EMPTY && varGroupId.vt != VT_NULL)
|
|
|
+ {
|
|
|
+ // 查询指定订单号的顾客组信息;
|
|
|
+ {// 本人;
|
|
|
+ strSql.Format(_T("select * from tb_ErpCustomerGroupMembers where GM_CustomerGroupID = '%s' and GM_Relation = '本人'"), varGroupId.bstrVal);
|
|
|
+ _RecordsetPtr rsCusMembers;
|
|
|
+ rsCusMembers.CreateInstance(__uuidof(Recordset));
|
|
|
+ hr = rsCusMembers->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ CString str;
|
|
|
+ if (rsCusMembers->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ str = rsCusMembers->GetCollect(_T("GM_RelatedPersonID"));
|
|
|
+ if (str.SpanIncluding(_T("0123456789")).IsEmpty())
|
|
|
+ {// 不是数字;
|
|
|
+ /*str = rsCusMembers->GetCollect(_T("GM_CustomerID"));
|
|
|
+ if (str.SpanIncluding(_T("0123456789")).IsEmpty())
|
|
|
+ {// 不是数字;
|
|
|
+
|
|
|
+ }*/
|
|
|
+
|
|
|
+ // 重新生成新的顾客信息;
|
|
|
+ // 儿童;//儿童姓名可能空,此时不添加;
|
|
|
+ if (name2.vt != VT_NULL && name2.vt != VT_EMPTY && _tcscmp(name2.bstrVal, _T("")) != 0)
|
|
|
+ {
|
|
|
+ // 这个宝宝是否存在;
|
|
|
+ varCustomerId2 = [&, this]()->_variant_t {
|
|
|
+ // 根据家长ID来查找tb_ErpCustomerGroupMembers;
|
|
|
+ CString str;
|
|
|
+ str.Format(_T("SELECT * FROM tb_ErpCustomer WHERE Cus_CustomerNumber IN (")
|
|
|
+ _T("SELECT GM_RelatedPersonID FROM [tb_ErpCustomerGroupMembers] WHERE GM_CustomerID = '%s' ) and Cus_Type = '儿童'"), varCustomerId.bstrVal);
|
|
|
+ _RecordsetPtr rsView;
|
|
|
+ _variant_t ChildId;
|
|
|
+ rsView.CreateInstance(__uuidof(Recordset));
|
|
|
+ hr = rsView->Open(_variant_t(str), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ while (rsView->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ if (_tcscmp(rsView->GetCollect(_T("Cus_Name")).bstrVal, name2.bstrVal) == 0)
|
|
|
+ {
|
|
|
+ ChildId = rsView->GetCollect(_T("Cus_CustomerNumber"));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ rsView->MoveNext();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsView->Close();
|
|
|
+ }
|
|
|
+
|
|
|
+ return ChildId;
|
|
|
+ }();
|
|
|
+
|
|
|
+ if (varCustomerId2.vt == VT_NULL || varCustomerId2.vt == VT_EMPTY)
|
|
|
+ {
|
|
|
+ // 没有该儿童, 创建一个;
|
|
|
+ _RecordsetPtr rsCustomer;
|
|
|
+ rsCustomer.CreateInstance(__uuidof(Recordset));
|
|
|
+ hr = rsCustomer->Open(_T("select * from tb_ErpCustomer"), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ rsCustomer->AddNew();
|
|
|
+ rsCustomer->PutCollect(_T("Cus_DividedShop"), Global::g_szPlatinumBranchId);
|
|
|
+ rsCustomer->PutCollect(_T("Cus_CustomerNumber"), varCustomerId2 = [&, this]()->_variant_t {
|
|
|
+ TCHAR szUID[24] = { 0 };
|
|
|
+ _ui64tot_s(m_uniqueid.get_unique_id(), szUID, 24, 10);
|
|
|
+ return szUID;
|
|
|
+ }());
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Type"), _T("儿童"));
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Name"), name2);
|
|
|
+ // 拼音;
|
|
|
+ rsCustomer->PutCollect(_T("Cus_NamePinyin"), rsclient->GetCollect(_T("pinyin2")));
|
|
|
+ // 生日;
|
|
|
+ _variant_t varCheck = rsclient->GetCollect(_T("check1"));
|
|
|
+
|
|
|
+ if (varCheck.vt != VT_EMPTY && varCheck.vt != VT_NULL && _tcscmp(varCheck.bstrVal, _T("0")) == 0)
|
|
|
+ {
|
|
|
+ if (CalendarEx::IsValidSolarDate(rsclient->GetCollect(_T("birthday1")).bstrVal))
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Birthday"), rsclient->GetCollect(_T("birthday1")));
|
|
|
+
|
|
|
+ rsCustomer->PutCollect(_T("Cus_BirthdayLunar"), varCheck);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (CalendarEx::IsValidLunanrDate(rsclient->GetCollect(_T("birthday1")).bstrVal))
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Birthday"), rsclient->GetCollect(_T("birthday1")));
|
|
|
+
|
|
|
+ rsCustomer->PutCollect(_T("Cus_BirthdayLunar"), varCheck);
|
|
|
+ }
|
|
|
+
|
|
|
+ //rsCustomer->PutCollect(_T("Cus_Telephone"), varTelPhone1);
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Zodiac"), rsclient->GetCollect(_T("zodiac")));
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Sex"), _tcscmp(rsclient->GetCollect(_T("sex")).bstrVal, _T("女")) == 0 ? true : false);
|
|
|
+ DATENULL(rsCustomer, _T("Cus_CreateDateTime"), rsclient->GetCollect(_T("time1")));
|
|
|
+ //rsCustomer->PutCollect(_T("Cus_QQ"), rsClient->GetCollect(_T("qq1")));
|
|
|
+ // Cus_DayForMarriage 婚期;Cus_QQ
|
|
|
+ rsCustomer->Update();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 更新组信息;
|
|
|
+ if (varCustomerId2.vt != VT_EMPTY && varCustomerId2.vt != VT_NULL)
|
|
|
+ {
|
|
|
+ rsCusMembers->PutCollect(_T("GM_RelatedPersonID"), varCustomerId2);
|
|
|
+ rsCusMembers->PutCollect(_T("GM_CustomerID"), varCustomerId2);
|
|
|
+ rsCusMembers->Update();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ varCustomerId2 = rsCusMembers->GetCollect(_T("GM_CustomerID"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ rsCusMembers->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ {// 家长;
|
|
|
+ strSql.Format(_T("select * from tb_ErpCustomerGroupMembers where GM_CustomerGroupID = '%s' and GM_Relation = '家长'"), varGroupId.bstrVal);
|
|
|
+ _RecordsetPtr rsCusMembers;
|
|
|
+ rsCusMembers.CreateInstance(__uuidof(Recordset));
|
|
|
+ hr = rsCusMembers->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ CString str;
|
|
|
+ if (rsCusMembers->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ str = rsCusMembers->GetCollect(_T("GM_RelatedPersonID"));
|
|
|
+ if (str.SpanIncluding(_T("0123456789")).IsEmpty())
|
|
|
+ {// 不是数字;
|
|
|
+ // 顾客id;
|
|
|
+ varCustomerId = rsCusMembers->GetCollect(_T("GM_CustomerID"));
|
|
|
+
|
|
|
+ // 更正组信息;
|
|
|
+ if (varCustomerId2.vt != VT_EMPTY && varCustomerId2.vt != VT_NULL)
|
|
|
+ {
|
|
|
+ rsCusMembers->PutCollect(_T("GM_RelatedPersonID"), varCustomerId2);
|
|
|
+ rsCusMembers->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 更正家长信息;
|
|
|
+ if (varCustomerId.vt != VT_EMPTY && varCustomerId.vt != VT_NULL)
|
|
|
+ {
|
|
|
+ _RecordsetPtr rsCustomer;
|
|
|
+ rsCustomer.CreateInstance(__uuidof(Recordset));
|
|
|
+ strSql.Format(_T("select * from tb_ErpCustomer where Cus_CustomerNumber = '%s'"), varCustomerId.bstrVal);
|
|
|
+ hr = rsCustomer->Open(_variant_t(strSql), _variant_t((IDispatch*)m_pPlatinumConnection, true), adOpenDynamic, adLockOptimistic, adCmdText);
|
|
|
+ if (SUCCEEDED(hr))
|
|
|
+ {
|
|
|
+ if (rsCustomer->adoEOF == VARIANT_FALSE)
|
|
|
+ {
|
|
|
+ rsCustomer->PutCollect(_T("Cus_Name"), name1);
|
|
|
+ rsCustomer->PutCollect(_T("Cus_NamePinyin"), rsclient->GetCollect(_T("pinyin1")));
|
|
|
+ rsCustomer->Update();
|
|
|
+ }
|
|
|
+
|
|
|
+ rsCustomer->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ rsCusMembers->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ rsclient->MoveNext();
|
|
|
+ }
|
|
|
+ rsclient->Close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void c2p::c2pResetNotChildOrder(CString strOrder)
|
|
|
+{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ //////////////////////////////////////////////////////////////////////////
|
|
|
+ {
|
|
|
+ CString strSql;
|
|
|
+ auto fun = [&, this](CString sql) {
|
|
|
+ _CommandPtr pCommand;
|
|
|
+ pCommand.CreateInstance(__uuidof(Command));
|
|
|
+ pCommand->ActiveConnection = m_pPlatinumConnection;
|
|
|
+ pCommand->CommandTimeout = 120;
|
|
|
+ pCommand->CommandText = _bstr_t(sql);
|
|
|
+ pCommand->Execute(NULL, NULL, adCmdText);
|
|
|
+ };
|
|
|
+
|
|
|
+ //CString str = _T("(select Ord_Number from tb_ErpOrder where Ord_Type = 2 and Ord_Number like 'JD%' and Ord_OrderClass = '经典订单')");
|
|
|
+ // 加挑数据;
|
|
|
+ strSql = _T("delete from tb_ErpPlusPickItems where Plu_OrdNumber in (select Ord_Number from tb_ErpOrder where Ord_Type = 2 and Ord_Number like 'JD%' and Ord_OrderClass = '经典订单')");
|
|
|
+ fun(strSql);
|
|
|
+
|
|
|
+ // 收款数据;
|
|
|
+ strSql = _T("delete from tb_ErpPayment where Pay_OrdNumber in (select Ord_Number from tb_ErpOrder where Ord_Type = 2 and Ord_Number like 'JD%' and Ord_OrderClass = '经典订单')");
|
|
|
+ fun(strSql);
|
|
|
+
|
|
|
+ // 订单商品;
|
|
|
+ strSql = _T("delete from tb_ErpOrderProductList where OPlist_OrderNumber in (select Ord_Number from tb_ErpOrder where Ord_Type = 2 and Ord_Number like 'JD%' and Ord_OrderClass = '经典订单')");
|
|
|
+ fun(strSql);
|
|
|
+
|
|
|
+ // 订单阶段;
|
|
|
+ strSql = _T("delete from tb_ErpOrdersPhotography where Ordpg_Number in (select Ord_Number from tb_ErpOrder where Ord_Type = 2 and Ord_Number like 'JD%' and Ord_OrderClass = '经典订单')");
|
|
|
+ fun(strSql);
|
|
|
+
|
|
|
+ // 订单数码表;
|
|
|
+ strSql = _T("delete from tb_ErpOrderDigital where Ordv_Number in (select Ord_Number from tb_ErpOrder where Ord_Type = 2 and Ord_Number like 'JD%' and Ord_OrderClass = '经典订单')");
|
|
|
+ fun(strSql);
|
|
|
+
|
|
|
+ // 订单数码状态;
|
|
|
+ strSql = _T("delete from tb_ErpOrderDigitalStatus where Ords_OrdNumber in (select Ord_Number from tb_ErpOrder where Ord_Type = 2 and Ord_Number like 'JD%' and Ord_OrderClass = '经典订单')");
|
|
|
+ fun(strSql);
|
|
|
+
|
|
|
+ // 订单接单人;
|
|
|
+ strSql = _T("delete from tb_ErpOrdersPerson where OrdPe_OrderNumber in (select Ord_Number from tb_ErpOrder where Ord_Type = 2 and Ord_Number like 'JD%' and Ord_OrderClass = '经典订单')");
|
|
|
+ fun(strSql);
|
|
|
+
|
|
|
+ // 订单顾客组成员;
|
|
|
+ strSql = _T("delete from tb_ErpCustomerGroupMembers where GM_CustomerGroupID in(select GP_CustomerGroupID from tb_ErpCustomerGroup where GP_OrderNumber in (select Ord_Number from tb_ErpOrder where Ord_Type = 2 and Ord_Number like 'JD%' and Ord_OrderClass = '经典订单'))");
|
|
|
+ fun(strSql);
|
|
|
+
|
|
|
+ // 订单顾客组;
|
|
|
+ strSql = _T("delete from tb_ErpCustomerGroup where GP_OrderNumber in (select Ord_Number from tb_ErpOrder where Ord_Type = 2 and Ord_Number like 'JD%' and Ord_OrderClass = '经典订单')");
|
|
|
+ fun(strSql);
|
|
|
+
|
|
|
+ // 订单;
|
|
|
+ strSql = _T("delete from tb_ErpOrder where Ord_Type = 2 and Ord_Number like 'JD%' and Ord_OrderClass = '经典订单'");
|
|
|
+ fun(strSql);
|
|
|
+ }
|
|
|
+
|
|
|
+ c2pCustomerOrder(strOrder);
|
|
|
+ }
|
|
|
+ catch (_com_error &e)
|
|
|
+ {
|
|
|
+ _bstr_t bstrSource(e.Source());
|
|
|
+ _bstr_t bstrDescription(e.Description());
|
|
|
+ WriteTextLog(_T("%s,%d =>%08lx,%s,%s,%s"), __FUNCTIONW__, __LINE__, e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|