Beispiel #1
0
        private void LoadData()
        {
            m_executeScript.Clear();
            shtView.RowCount = 0;

            List <BOMSetupViewDTO> list = m_bomSetupController.LoadBOMSetup(txtItemCD.Text.ToNZString());

            if (m_rootBOMNode != null)
            {
                m_rootBOMNode.Nodes.Clear();
            }


            m_rootBOMNode = WriteToBOMNode(list);
            if (m_rootBOMNode != null)
            {
                m_rootBOMNode.ExpandAll();
                FillBOMNodeToGrid((BOMNode)m_rootBOMNode);
                ExpandNode(m_rootBOMNode);
            }

            SetOrderLoactionandMRPFlag();

            UpdateUpDownButton();
        }
Beispiel #2
0
        private void miEditItem_Click(object sender, EventArgs e)
        {
            BOMNode         activeNode   = shtView.ActiveRow.Tag as BOMNode;
            BOMSetupViewDTO activeBOMDTO = activeNode.DTO;
            //if(activeBOMDTO.MRP_FLAG.Value.ToString().Length > 2)
            //    activeBOMDTO.MRP_FLAG = ((Convert.ToString(activeBOMDTO.MRP_FLAG.StrongValue)).Substring(0, 2)).ToNZString();

            MAS052_ChangeItem dialog = new MAS052_ChangeItem(activeBOMDTO);

            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)
                {
                    // Use explosion BOM from in-memory.
                    copyNode = (BOMNode)listCopyNode[0].Clone();
                }
                else
                {
                    // Load Explosion BOM from database.
                    List <BOMSetupViewDTO> dbListDTO = m_bomSetupController.LoadBOMSetup(selectedItem.ITEM_CD);
                    copyNode = WriteToBOMNode(dbListDTO);
                }

                //== Create new DTO.
                //BOMSetupViewDTO dto = activeNode.DTO.Clone() as BOMSetupViewDTO;
                BOMSetupViewDTO dto = copyNode.DTO.Clone() as BOMSetupViewDTO;
                dto.UPPER_ITEM_CD.Value         = activeBOMDTO.UPPER_ITEM_CD.Value;
                dto.UPPER_ITEM_CLS.Value        = activeBOMDTO.UPPER_ITEM_CLS.Value;
                dto.UPPER_ITEM_DESC.Value       = activeBOMDTO.UPPER_ITEM_DESC.Value;
                dto.UPPER_LOT_CONTROL_CLS.Value = activeBOMDTO.UPPER_LOT_CONTROL_CLS.Value;

                dto.LOWER_ITEM_CD.Value = selectedItem.ITEM_CD.Value;
                //dto.LOWER_ITEM_CLS.Value = selectedItem.ITEM_CLS.Value;
                dto.LOWER_ITEM_DESC.Value = selectedItem.ITEM_DESC.Value;
                //dto.LOWER_LOT_CONTROL_CLS.Value = selectedItem.LOT_CONTROL_CLS.Value;

                //dto.SEQ.Value = activeBOMDTO.SEQ.Value;
                dto.UPPER_QTY.Value = selectedItem.UPPER_QTY.Value;
                dto.LOWER_QTY.Value = selectedItem.LOWER_QTY.Value;
                //dto.CHILD_ORDER_LOC_CD.Value = selectedItem.CHILD_ORDER_LOC_CD.Value;
                //dto.MRP_FLAG.Value = selectedItem.MRP_FLAG.Value;
                copyNode.DTO = dto;

                List <BOMNode> listNodes = GetNodes(activeBOMDTO.UPPER_ITEM_CD.StrongValue, activeBOMDTO.LOWER_ITEM_CD.StrongValue);
                for (int i = 0; i < listNodes.Count; i++)
                {
                    // Remove old node and replace with new node.

                    BOMNode oldNode    = listNodes[i];
                    int     oldIndex   = oldNode.Index;
                    BOMNode parentNode = (BOMNode)oldNode.Parent;

                    oldNode.Remove();
                    BOMNode newNode = (BOMNode)copyNode.Clone();
                    newNode.ExpandAll();
                    parentNode.Nodes.Insert(oldIndex, newNode);
                }

                shtView.RowCount = 0;
                FillBOMNodeToGrid(m_rootBOMNode);
                CollapseNode(m_rootBOMNode);
                ExpandNode(m_rootBOMNode);


                UpdateSqlExecute execute1 = new UpdateSqlExecute(dto, activeBOMDTO.UPPER_ITEM_CD, activeBOMDTO.LOWER_ITEM_CD);
                m_executeScript.Add(execute1);

                SetOrderLoactionandMRPFlag();
            }
        }
Beispiel #3
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();
            }
        }