コード例 #1
0
ファイル: Session.cs プロジェクト: beirbear/PrivateDCP
        public void GetItemListRound(out ItemsPool allDcpItems, out ItemsPool allAmrItems)
        {
            if (_customerOrder == null)
            {
                GetItemListAll(out allDcpItems, out allAmrItems);
                _customerOrder = (List<CustomerOrder>)DeepClone(customerOrder);
                return;
            }

            ItemsPool itemPool = new ItemsPool();
            ItemsPool itemPoolAmr = new ItemsPool();

            for (int i = 0; i < customerOrder.Count; i++)
            {
                var res = _customerOrder.Where(e => e.CustomerName == customerOrder[i].CustomerName).SingleOrDefault();

                if (customerOrder[i].IsSkip)
                    continue;

                ////// DCP
                List<OrderedItem> items = customerOrder[i].GetOrderedList();
                if (res == null)
                {
                    // Customer make an order
                    foreach (OrderedItem item in items)
                        itemPool.AddNewItem(item);
                }
                else
                {
                    // Check for addtional item
                    foreach (OrderedItem item in items)
                        if(!res.HasOrderedItem(item.Name, item.Note, item.Unit, item.Amount))
                            itemPool.AddNewItem(item);
                }

                ////// AMR
                items = customerOrder[i].GetOrderedListAmr();
                if (res == null)
                {
                    // Customer make an order
                    foreach (OrderedItem item in items)
                        itemPoolAmr.AddNewItem(item);
                }
                else
                {
                    // Check for addtional item
                    foreach (OrderedItem item in items)
                        if (!res.HasOrderedItemAmr(item.Name, item.Note, item.Unit, item.Amount))
                            itemPoolAmr.AddNewItem(item);
                }
            }

            ///// STAMP FOR CUSTOMER ORDER
            _customerOrder = (List<CustomerOrder>)DeepClone(customerOrder);

            allDcpItems = itemPool;
            allAmrItems = itemPoolAmr;
        }
コード例 #2
0
ファイル: ItemsListForm.cs プロジェクト: beirbear/PrivateDCP
        public ItemsListForm(ItemsPool dcpList, ItemsPool amrList, string date, string route)
        {
            InitializeComponent();
            InitializePrinter();

            // Initilize List
            dcpMale = new List<ItemSet>();
            dcpFemale = new List<ItemSet>();
            amrMale = new List<ItemSet>();

            this.Text = "เดชาพาณิชย์ - รายการจัดของ";

            this.dcpList = dcpList;
            this.amrList = amrList;
            this.date = date;
            this.route = route;

            tbControlMinWidth = this.tabControlItems.Width;
            tbControlMinHeight = this.tabControlItems.Height;
            btnCopyMinYLoc = this.buttonCopy.Location.Y;

            ///// PROCESS ITEM FOR MALE DCP
            // 1. DETERMINE WHICH ITEMS ARE FOR MALE EMPLOYEES AND WHICH ARE FEMALE
            // 2. GROUP THEM WITH STORED LOCATION
            // 3. SORT ITEMS WHICH GROUP BY LOCATION BY UNIT WEIGHT PREFERENCE
            ///// FOR FEMALE ITEMS AND ARMAR
            // LOCATION GROUPING IS NO, JUST SORT

            ////// STEP 1
            unitIndex = Space.GetUnitIndex();
            locIndex = Space.GetLocationIndex();
            string message = string.Format("รายการของจัด {0} วันที่ {1}\r\nพนักงาน ชาย\r\n", route, date);
            message += string.Format("รวม\tหน่วย\tรายการ\tจำนวน\r\n");

            ///// LOOP FOR STORED LOCATION
            for (int j = 0; j < locIndex.Count; j++)
            {
                ///// LOOP FOR UNIT
                for (int i = 0; i < unitIndex.Count; i++)
                {
                    ////// GET ITEMS AND ORDER BY NAME
                    List<ItemIdentity> resSet = dcpList.GetItemsByUnitLocationAndOperative(unitIndex[i], locIndex[j], Space.OperativeType.Male);
                    for (int k = 0; k < resSet.Count; k++)
                    {
                        message += resSet[k].GetTotalAmount();
                        message += string.Format("\t{0}\t{1}{2}\t{3}\r\n", resSet[k].Unit, resSet[k].Name, (string.IsNullOrEmpty(resSet[k].Note) ? "" : " (" + resSet[k].Note + ")"), resSet[k].GetItemOrderInline());
                        dcpMale.Add(new ItemSet(resSet[k].Name, resSet[k].Unit, resSet[k].GetTotalAmount(), resSet[k].GetItemOrderInline()));
                    }
                }

                ////// GET ITEMS THAT HAS A SPECIAL UNIT
                List<ItemIdentity> otherSet = dcpList.GetItemsByUnitException(unitIndex, locIndex[j], Space.OperativeType.Male);
                for (int k = 0; k < otherSet.Count; k++)
                {
                    message += otherSet[k].GetTotalAmount();
                    message += string.Format("\t{0}\t{1}{2}\t{3}\r\n", otherSet[k].Unit, otherSet[k].Name, (string.IsNullOrEmpty(otherSet[k].Note) ? "" : " (" + otherSet[k].Note + ")"), otherSet[k].GetItemOrderInline());
                    dcpMale.Add(new ItemSet(otherSet[k].Name, otherSet[k].Unit, otherSet[k].GetTotalAmount(), otherSet[k].GetItemOrderInline()));
                }
            }

            richTextBox1.Text = message;
            message = string.Format("รายการของจัด {0} วันที่ {1}\r\nพนักงาน หญิง\r\n", route, date);
            message += string.Format("รวม\tหน่วย\tรายการ\tจำนวน\r\n");

            ///// LOOP FOR STORED LOCATION
            for (int j = 0; j < locIndex.Count; j++)
            {
                ///// LOOP FOR UNIT
                for (int i = 0; i < unitIndex.Count; i++)
                {
                    ////// GET ITEMS AND ORDER BY NAME
                    List<ItemIdentity> resSet = dcpList.GetItemsByUnitLocationAndOperative(unitIndex[i], locIndex[j], Space.OperativeType.Female);
                    for (int k = 0; k < resSet.Count; k++)
                    {
                        message += resSet[k].GetTotalAmount();
                        message += string.Format("\t{0}\t{1}{2}\t{3}\r\n", resSet[k].Unit, resSet[k].Name, (string.IsNullOrEmpty(resSet[k].Note) ? "" : " (" + resSet[k].Note + ")"), resSet[k].GetItemOrderInline());
                        dcpFemale.Add(new ItemSet(resSet[k].Name, resSet[k].Unit, resSet[k].GetTotalAmount(), resSet[k].GetItemOrderInline()));
                    }
                }

                List<ItemIdentity> otherSet = dcpList.GetItemsByUnitException(unitIndex, locIndex[j], Space.OperativeType.Female);
                for (int k = 0; k < otherSet.Count; k++)
                {
                    message += otherSet[k].GetTotalAmount();
                    message += string.Format("\t{0}\t{1}{2}\t{3}\r\n", otherSet[k].Unit, otherSet[k].Name, (string.IsNullOrEmpty(otherSet[k].Note) ? "" : " (" + otherSet[k].Note + ")"), otherSet[k].GetItemOrderInline());
                    dcpFemale.Add(new ItemSet(otherSet[k].Name, otherSet[k].Unit, otherSet[k].GetTotalAmount(), otherSet[k].GetItemOrderInline()));
                }
            }
            richTextBox2.Text = message;

            ///// AMR
            message = string.Format("รายการของจัด {0} วันที่ {1}\r\nพนักงาน อาม่า\r\n", route, date);
            message += string.Format("รวม\tหน่วย\tรายการ\tจำนวน\r\n");

            List<ItemIdentity> amrItem = amrList.GetItemsOrderByUnitAndName();
            for (int i = 0; i < amrItem.Count; i++)
            {
                message += amrItem[i].GetTotalAmount();
                message += string.Format("\t{0}\t{1}{2}\t{3}\r\n", amrItem[i].Unit, amrItem[i].Name, (string.IsNullOrEmpty(amrItem[i].Note) ? "" : " (" + amrItem[i].Note + ")"), amrItem[i].GetItemOrderInline());
                amrMale.Add(new ItemSet(amrItem[i].Name, amrItem[i].Unit, amrItem[i].GetTotalAmount(), amrItem[i].GetItemOrderInline()));
            }
            richTextBox3.Text = message;
        }
コード例 #3
0
ファイル: Session.cs プロジェクト: beirbear/PrivateDCP
        public void GetItemListAll(out ItemsPool allDcpItems, out ItemsPool allAmrItems)
        {
            ItemsPool itemPool = new ItemsPool();
            ItemsPool itemPoolAmr = new ItemsPool();
            foreach (CustomerOrder cust in customerOrder)
            {
                if (cust.IsSkip)
                    continue;

                List<OrderedItem> items = cust.GetOrderedList();
                foreach (OrderedItem item in items)
                    itemPool.AddNewItem(item);

                items = cust.GetOrderedListAmr();
                foreach (OrderedItem item in items)
                    itemPoolAmr.AddNewItem(item);
            }

            allDcpItems = itemPool;
            allAmrItems = itemPoolAmr;
        }