Beispiel #1
0
        private void fpView_CellDoubleClick(object sender, CellClickEventArgs e)
        {
            if (shtView.RowCount <= 0)
            {
                return;
            }
            if (e.Button == MouseButtons.Left)
            {
                //if (!e.ColumnHeader)
                //    miEditItem.PerformClick();

                if (!e.ColumnHeader)
                {
                    BOMNode node = shtView.Rows[e.Row].Tag as BOMNode;
                    if (node.IsExpanded)
                    {
                        node.Collapse(true);
                        CollapseNode(node);
                    }
                    else
                    {
                        node.Expand();
                        ExpandNode(node);
                    }
                }
            }
        }
Beispiel #2
0
        private void miAddChildItem_Click(object sender, EventArgs e)
        {
            BOMNode         activeNode   = shtView.ActiveRow.Tag as BOMNode;
            BOMSetupViewDTO activeBOMDTO = activeNode.DTO;

            MAS051_RegisterBOM dialog = new MAS051_RegisterBOM(activeBOMDTO.LOWER_ITEM_CD.StrongValue);

            dialog.ShowDialog();

            if (dialog.IsSelected)
            {
                BOMRegisterUIDM selectedItem = dialog.SelectedItem;

                //== Decision to use data from in-memory or database.
                List <BOMNode> listCopyNode = GetNodesOnLowerItem(selectedItem.ITEM_CD.StrongValue);
                BOMNode        copyNode     = null;
                if (listCopyNode != null && listCopyNode.Count > 0)
                {
                    //if (listCopyNode[0].Nodes.Count > 0)  // has child.
                    copyNode = (BOMNode)listCopyNode[0].Clone();
                }
                else
                {
                    List <BOMSetupViewDTO> dbListDTO = m_bomSetupController.LoadBOMSetup(selectedItem.ITEM_CD);
                    copyNode = WriteToBOMNode(dbListDTO);
                }


                // == Validate before add child item.

                bool bCheck = CheckBeforeAddNewChildItem(activeNode, copyNode);
                if (bCheck == false)
                {
                    return;
                }

                //===================

                BOMNode lastChildNode = (BOMNode)activeNode.LastNode;
                int     nextSeq       = 1;
                if (lastChildNode != null)
                {
                    //nextSeq = lastChildNode.DTO.SEQ.NVL(0) + 1;
                }

                //BOMBIZ biz = new BOMBIZ();
                //int nextSeq = biz.GetNextSequenceOfUpperItem(activeBOMDTO.LOWER_ITEM_CD);

                // Create new BOMDTO
                BOMSetupViewDTO dto = new BOMSetupViewDTO();
                dto.UPPER_ITEM_CD.Value = activeBOMDTO.LOWER_ITEM_CD.Value;
                dto.LOWER_ITEM_CD.Value = selectedItem.ITEM_CD.Value;
                //dto.SEQ.Value = nextSeq;
                dto.UPPER_QTY.Value = selectedItem.UPPER_QTY.Value;
                dto.LOWER_QTY.Value = selectedItem.LOWER_QTY.Value;

                dto.UPPER_ITEM_CLS.Value        = activeBOMDTO.LOWER_ITEM_CLS.Value;
                dto.UPPER_ITEM_DESC.Value       = activeBOMDTO.LOWER_ITEM_DESC.Value;
                dto.UPPER_LOT_CONTROL_CLS.Value = activeBOMDTO.LOWER_LOT_CONTROL_CLS.Value;
                dto.UPPER_CONSUMTION_CLS.Value  = activeBOMDTO.LOWER_CONSUMTION_CLS.Value;

                dto.LOWER_ITEM_DESC.Value = selectedItem.ITEM_DESC.Value;
                //dto.LOWER_ITEM_CLS.Value = selectedItem.ITEM_CLS.Value;
                //dto.LOWER_LOT_CONTROL_CLS.Value = selectedItem.LOT_CONTROL_CLS.Value;
                //dto.LOWER_CONSUMTION_CLS.Value = selectedItem.CONSUMTION_CLS.Value;

                dto.PATH.Value = activeBOMDTO.PATH.StrongValue + "~" + selectedItem.ITEM_CD.StrongValue;
                //dto.CHILD_ORDER_LOC_CD.Value = selectedItem.CHILD_ORDER_LOC_CD.Value;
                //dto.MRP_FLAG.Value = selectedItem.MRP_FLAG.Value;
                // Insert new node.
                List <BOMNode> listNodes = GetNodesOnLowerItem(activeBOMDTO.LOWER_ITEM_CD.StrongValue);
                for (int i = 0; i < listNodes.Count; i++)
                {
                    BOMSetupViewDTO newDTO = dto.Clone() as BOMSetupViewDTO;

                    BOMNode newNode = null;
                    if (copyNode == null)
                    {
                        newNode     = (BOMNode)copyNode.Clone();
                        newNode.DTO = newDTO;
                    }
                    else
                    {
                        newNode     = copyNode.Clone() as BOMNode;
                        newNode.DTO = newDTO;
                        newNode.ExpandAll();
                    }

                    listNodes[i].Nodes.Add(newNode);
                }

                shtView.RowCount = 0;

                FillBOMNodeToGrid(m_rootBOMNode);

                activeNode.Expand();
                CollapseNode(m_rootBOMNode);
                ExpandNode(m_rootBOMNode);

                InsertSqlExecute execute1 = new InsertSqlExecute(dto);
                m_executeScript.Add(execute1);

                SetOrderLoactionandMRPFlag();
            }
        }