///************************************************************************/
/*  Copyright (C), 2016-2020, [IT], ��������Ȩ��;
/*  ģ �� ����;
/*  ��    ����;
/*
/*  ��    ����[V];	
/*  ��    �ߣ�[IT];
/*  ��    �ڣ�[4/26/2016];
/*
/*
/*  ע    �⣺;
/*
/*  �޸ļ�¼��[IT];
/*  �޸����ڣ�;
/*  �޸İ汾��;
/*  �޸����ݣ�;
/************************************************************************/
#ifndef __DLG_SCAN_BARCODE__
#define __DLG_SCAN_BARCODE__
#include "afxwin.h"
#include ".\list\SortListCtrl.h"

#pragma once

class CEnEdit : public CEdit
{
	DECLARE_DYNAMIC(CEnEdit)
public:
	CEnEdit();
	virtual ~CEnEdit();

	int m_nLines;
	CDialog* m_pParent;
	BOOL m_bLockKbdLayout;
protected:
	virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
	DECLARE_MESSAGE_MAP()

	HKL	m_DefaultHKL;
	HKL m_Save_KbdLayout;
	HKL GetDefaultKbdLayout();

public:
	afx_msg void OnEnKillfocus();
	afx_msg void OnEnSetfocus();
	//afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
};

typedef struct __OrderItems__  {	
	int nIndex;
	CString	strOrder;			// 1.������;
	CString strAutoId;			// 2.��Ʒautoid;
	CString strSPId;			// 3.��Ʒ���к�;
	CString strSPName;			// 4.��Ʒ����;
	CString strSPLb;			// 5.��Ʒ���;
	CString strBackStatus;		// 6.������Ʒ���״̬;
	CString strPickupStatus;	// 7.������Ʒȡ��״̬;
	CString strShuliang;		// 8.��Ʒ����;
	CString strBackCot;			// 9.�������;
	CString strPickupCot;		// 10.ȡ������;

	__OrderItems__()
	{
		nIndex = -1;
		strOrder = _T("");
		strAutoId = _T("");
		strSPId = _T("");
		strSPName = _T("");
		strSPLb = _T("");
		strBackStatus = _T("");
		strPickupStatus = _T("");
		strShuliang = _T("");
		strBackCot = _T("");
		strPickupCot = _T("");
	}

	const __OrderItems__& operator=(const __OrderItems__ &others)
	{
		if ( &others == this )
			return *this;

		nIndex = others.nIndex;
		strOrder = others.strOrder;
		strAutoId = others.strAutoId;
		strSPId = others.strSPId;
		strSPName = others.strSPName;
		strSPLb = others.strSPLb;
		strBackStatus = others.strBackStatus;
		strPickupStatus = others.strPickupStatus;
		strShuliang = others.strShuliang;
		strBackCot = others.strBackCot;
		strPickupCot = others.strPickupCot;

		return *this;
	}

}OrderItems, *pOrderItems;

typedef struct __OUTWAREHOUSE__
{
	int nIndex;
	CString	strOrder;
	CString	strSPLB;
	CString	strSPName;
	CString	strCount;
	CString	strDate;
	CString	strClerk;
	CString	strRemark;

	__OUTWAREHOUSE__()
	{
		nIndex = -1;
		strOrder = _T("");
		strSPLB = _T("");
		strSPName = _T("");
		strCount = _T("");
		strDate = _T("");
		strClerk = _T("");
		strRemark = _T("");
	}

	const __OUTWAREHOUSE__& operator=(const __OUTWAREHOUSE__& others)
	{
		if ( &others == this )
			return *this;

		nIndex = others.nIndex;
		strOrder = others.strOrder;
		strSPLB = others.strSPLB;
		strSPName = others.strSPName;
		strCount = others.strCount;
		strDate = others.strDate;
		strClerk = others.strClerk;
		strRemark = others.strRemark;

		return *this;
	}
}OutWarehouse, *pOutWarehouse;

typedef struct __WITHIN__
{
	int nIndex;
	CString strBarCode;
}WithIn, *pWithIn;

// CDlgScanBarCode �Ի���

class CDlgScanBarCode : public CDialog
{
	DECLARE_DYNAMIC(CDlgScanBarCode)

public:
	CDlgScanBarCode(CWnd* pParent = NULL);   // ��׼���캯��
	virtual ~CDlgScanBarCode();

// �Ի�������
	enum { IDD = IDD_DLG_SCANBARCODE };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV ֧��

	DECLARE_MESSAGE_MAP()
public:
	virtual BOOL OnInitDialog();
protected:
	virtual void OnOK();
public:
	// ɨ������; == 0 ��ʾɨ��ؼ�;  1== ��ʾɨ��ȡ��;
	int	m_nScanMode;
	// ����ǹɨ���������;
	CEnEdit m_EtBarCode;
	// û�в��ҵ�����Ʒ��¼;
	CStringArray m_AryWithOut;	
	// �Ѵ��ڵ���Ʒ��¼;
	vector<WithIn> m_vtWithIn;
	// ������Ʒ;
	CArray<CStringArray, CStringArray> m_AryOrderItems;
	// �����;
	CArray<CStringArray, CStringArray> m_AryOutWarehouse;
	// 
	void DealScanBarCode(const int& nlines);

	// ��ʼ��list;
	void InitSortList();
	// ɨ����;
	CSortListCtrl m_ScanResult;
protected:
	virtual void OnCancel();
};

#endif // __DLG_SCAN_BARCODE__