Ejemplo n.º 1
0
        private bool addMaterielType()
        {
            MaterielTypeTable materielType = new MaterielTypeTable();

            materielType.name = this.textBoxMaterielGroupName.Text.ToString();
            materielType.num  = this.textBoxGroupNum.Text.ToString();
            materielType.desc = this.textBoxMaterielGroupDesc.Text.ToString();

            if (materielType.name.Length == 0)
            {
                MessageBoxExtend.messageWarning("物料分组保存失败, 组名称不能为空,请重新输入!");
                return(false);
            }

            if (materielType.num.Length == 0 || materielType.num.Length > 10)
            {
                MessageBoxExtend.messageWarning("物料分组保存失败, 组编号长度必须为1-10位,请重新输入!");
                return(false);
            }

            MaterielType.getInctance().insert(materielType);


            // 物料组织结构
            MaterielOrgStructTable materielOrgInfo = new MaterielOrgStructTable();

            materielOrgInfo.parentPkey = MaterielOrgStruct.getInctance().getPkeyFromValue(m_materielGroupPkey);
            materielOrgInfo.value      = MaterielType.getInctance().getMaxPkey();
            MaterielOrgStruct.getInctance().insert(materielOrgInfo);

            return(true);
        }
Ejemplo n.º 2
0
        private void FormMaterielEdit_Load(object sender, EventArgs e)
        {
            // 初始化下拉框值
            ComboBoxExtend.initComboBox(this.comboBoxMaterielAttribut, MATERIEL_ATTRIBUTE_TABLE_NAME, true);
            ComboBoxExtend.initComboBox(this.comboBoxValuationType, VALUATION_TYPE_LIST_TABLE_NAME, true);
            ComboBoxExtend.initComboBox(this.comboBoxUnit, UNIT_LIST_TABLE_NAME, true);
            ComboBoxExtend.initComboBox(this.comboBoxUnitPurchase, UNIT_LIST_TABLE_NAME, true);
            ComboBoxExtend.initComboBox(this.comboBoxUnitSale, UNIT_LIST_TABLE_NAME, true);
            ComboBoxExtend.initComboBox(this.comboBoxStorage, STORAGE_LIST_TABLE_NAME, true);

            if (!m_isAdd)
            {
                this.buttonAdd.Enabled           = false;
                this.buttonMaterielGroup.Enabled = false;

                if (m_isEditMateriel)
                {
                    m_materiel = Materiel.getInctance().getMaterielInfoFromPkey(m_materielPkey);
                }
                else
                {
                    m_materielType    = MaterielType.getInctance().getMaterielTypeInfoFromPkey(m_materielGroupPkey);
                    m_isMaterielGroup = true;
                }

                setPageActiveState();
                setPageActiveValue();
            }

            m_isInit = true;
        }
Ejemplo n.º 3
0
        private void toolStripButtonRefresh_Click(object sender, EventArgs e)
        {
            MaterielProOccupiedOrder.getInctance().refreshRecord();
            MaterielProOccupiedOrderDetails.getInctance().refreshRecord();
            getMaterielProOccupiedList();

            MaterielType.getInctance().refreshRecord();
            MaterielOrgStruct.getInctance().refreshRecord();

            refreshTreeView();
            Materiel.getInctance().refreshRecord();
            updateDataGridView(Materiel.getInctance().getAllMaterielInfo());
        }
Ejemplo n.º 4
0
        private void modifyMaterielType()
        {
            MaterielTypeTable materielType = new MaterielTypeTable();

            materielType.name = this.textBoxMaterielGroupName.Text.ToString();
            materielType.desc = this.textBoxMaterielGroupDesc.Text.ToString();

            if (materielType.name.Length == 0)
            {
                MessageBoxExtend.messageWarning("组名称不能为空,请重新填写!");
                return;
            }

            MaterielType.getInctance().update(m_materielGroupPkey, materielType);
        }
Ejemplo n.º 5
0
 private void SuppierGroupDelete_Click(object sender, EventArgs e)
 {
     if (MessageBoxExtend.messageQuestion("确定删除[" + m_materielGroupName + "]分组信息吗?"))
     {
         if (m_materielRecordCount > 0)
         {
             MessageBoxExtend.messageWarning("[" + m_materielGroupName + "] 删除失败,请先删除物料记录然后重试.");
         }
         else
         {
             MaterielType.getInctance().delete(m_materielGroupPkey);
             MaterielOrgStruct.getInctance().delete(MaterielOrgStruct.getInctance().getPkeyFromValue(m_materielGroupPkey));
             refreshTreeView();
         }
     }
 }
Ejemplo n.º 6
0
        private void processDutyOrgNode(int parentID, TreeNode node)
        {
            string    nodeName = "";
            TreeNode  currentNode;
            ArrayList nodeList = MaterielOrgStruct.getInctance().getNodesFormParentID(parentID);

            for (int i = 0; i < nodeList.Count; i++)
            {
                MaterielOrgStructTable record = (MaterielOrgStructTable)nodeList[i];

                nodeName = MaterielType.getInctance().getMaterielTypeNameFromPkey(record.value);

                currentNode = m_tree.addNode(node, nodeName, 0, 1, Convert.ToString(record.value));
                processDutyOrgNode(record.pkey, currentNode);
            }
        }
Ejemplo n.º 7
0
        private void refreshTreeView()
        {
            if (m_tree != null && treeViewMaterielOrg.Nodes.Count > 0)
            {
                treeViewMaterielOrg.Nodes.Clear();
            }

            m_tree = new TreeViewExtend(this.treeViewMaterielOrg);

            if (m_type == 1)
            {
                int rootNodePkey = MaterielOrgStruct.getInctance().getRootNodePkey();

                int    rooNodeValue = MaterielOrgStruct.getInctance().getNoteValueFromPkey(rootNodePkey);
                string rootName     = MaterielType.getInctance().getMaterielTypeNameFromPkey(rooNodeValue);

                m_rootNode = this.treeViewMaterielOrg.Nodes.Add(Convert.ToString(rooNodeValue), rootName);

                processDutyOrgNodeMateriel(rootNodePkey, m_rootNode);
            }
            else if (m_type == 2)
            {
                int rootNodePkey = CustomerOrgStruct.getInctance().getRootNodePkey();

                int    rooNodeValue = CustomerOrgStruct.getInctance().getNoteValueFromPkey(rootNodePkey);
                string rootName     = CustomerType.getInctance().getCustomerTypeNameFromPkey(rooNodeValue);

                m_rootNode = this.treeViewMaterielOrg.Nodes.Add(Convert.ToString(rooNodeValue), rootName);

                processDutyOrgNodeCustomer(rootNodePkey, m_rootNode);
            }
            else if (m_type == 3)
            {
                int rootNodePkey = SupplierOrgStruct.getInctance().getRootNodePkey();

                int    rooNodeValue = SupplierOrgStruct.getInctance().getNoteValueFromPkey(rootNodePkey);
                string rootName     = SupplierType.getInctance().getSupplierTypeNameFromPkey(rooNodeValue);

                m_rootNode = this.treeViewMaterielOrg.Nodes.Add(Convert.ToString(rooNodeValue), rootName);

                processDutyOrgNodeSupplier(rootNodePkey, m_rootNode);
            }

            m_rootNode.Expand();
        }
Ejemplo n.º 8
0
        /*
         * 各种测试代码如下
         *
         * */
        private bool addMaterielTypeTest(int materielGroupPkey)
        {
            MaterielTypeTable materielType = new MaterielTypeTable();

            materielType.name = "addMaterielTypeTest";
            materielType.num  = "0";
            materielType.desc = "addMaterielTypeTest desc";

            MaterielType.getInctance().insert(materielType, false);


            // 物料组织结构
            MaterielOrgStructTable materielOrgInfo = new MaterielOrgStructTable();

            materielOrgInfo.parentPkey = MaterielOrgStruct.getInctance().getPkeyFromValue(materielGroupPkey);
            materielOrgInfo.value      = MaterielType.getInctance().getMaxPkey();
            MaterielOrgStruct.getInctance().insert(materielOrgInfo, false);

            return(true);
        }
Ejemplo n.º 9
0
        private void addMaterielType()
        {
            MaterielTypeTable materielType = new MaterielTypeTable();

            materielType.name = this.textBoxMaterielGroupName.Text.ToString();
            materielType.desc = this.textBoxMaterielGroupDesc.Text.ToString();

            if (materielType.name.Length == 0)
            {
                MessageBoxExtend.messageWarning("组名称不能为空,请重新输入!");
                return;
            }

            MaterielType.getInctance().insert(materielType);


            // 物料组织结构
            MaterielOrgStructTable materielOrgInfo = new MaterielOrgStructTable();

            materielOrgInfo.parentPkey = MaterielOrgStruct.getInctance().getPkeyFromValue(m_materielGroupPkey);
            materielOrgInfo.value      = MaterielType.getInctance().getMaxPkey();
            MaterielOrgStruct.getInctance().insert(materielOrgInfo);
        }
Ejemplo n.º 10
0
        private bool modifyMaterielType()
        {
            MaterielTypeTable materielType = new MaterielTypeTable();

            materielType.name = this.textBoxMaterielGroupName.Text.ToString();
            materielType.num  = this.textBoxGroupNum.Text.ToString();
            materielType.desc = this.textBoxMaterielGroupDesc.Text.ToString();

            if (materielType.name.Length == 0)
            {
                MessageBoxExtend.messageWarning("组名称不能为空,请重新填写!");
                return(false);
            }

            if (materielType.num.Length == 0 || materielType.num.Length > 10)
            {
                MessageBoxExtend.messageWarning("物料分组保存失败, 组编号长度必须为1-10位,请重新输入!");
                return(false);
            }

            MaterielType.getInctance().update(m_materielGroupPkey, materielType);

            return(true);
        }
Ejemplo n.º 11
0
        private void updateDataGridView(SortedDictionary <int, MaterielTable> materielList)
        {
            m_materielRecordCount            = materielList.Count;
            this.labelMaterielGroupName.Text = "[" + m_materielGroupName + "]物料共计[" + Convert.ToString(m_materielRecordCount) + "]条记录";

            SortedDictionary <int, ArrayList> materiels = new SortedDictionary <int, ArrayList>();


            SortedDictionary <int, AuxiliaryMaterialDataTable> AuxiliaryMaterialList =
                AuxiliaryMaterial.getInctance().getAuxiliaryListFromTableName("BASE_UNIT_LIST");

            SortedDictionary <int, AuxiliaryMaterialDataTable> AuxiliaryStorelList =
                AuxiliaryMaterial.getInctance().getAuxiliaryListFromTableName("BASE_STORAGE_LIST");

            for (int i = 0; i < materielList.Count; i++)
            {
                MaterielTable materiel = new MaterielTable();
                materiel = (MaterielTable)materielList[i];

                ArrayList temp = new ArrayList();
                temp.Add(materiel.pkey);
                temp.Add(materiel.materielType);
                temp.Add(materiel.name);
                temp.Add(materiel.num);

                temp.Add(MaterielType.getInctance().getMaterielTypeNameFromPkey(materiel.materielType));

                temp.Add(materiel.nameShort);
                temp.Add(materiel.mnemonicCode);
                temp.Add(materiel.model);
                temp.Add(materiel.brand);
                temp.Add(materiel.materielParameter);

                if (AuxiliaryStorelList.ContainsKey(materiel.storage))
                {
                    temp.Add(AuxiliaryStorelList[materiel.storage].name);
                }
                else
                {
                    temp.Add("");
                }

                temp.Add("移动加权平均");

                if (AuxiliaryMaterialList.ContainsKey(materiel.unit))
                {
                    temp.Add(AuxiliaryMaterialList[materiel.unit].name);
                }
                else
                {
                    temp.Add("");
                }

                temp.Add(materiel.CZ);
                temp.Add(materiel.max);
                temp.Add(materiel.min);
                temp.Add(materiel.warramty);
                temp.Add(materiel.note);
                materiels.Add(materiels.Count, temp);
            }

            m_dataGridViewExtend.initDataGridViewData(materiels, 4);
        }
Ejemplo n.º 12
0
        private void updateDataGridView(SortedDictionary <int, MaterielTable> materielList)
        {
            double sum = 0;

            m_materielRecordCount = materielList.Count;

            SortedDictionary <int, ArrayList> materiels = new SortedDictionary <int, ArrayList>();

            SortedDictionary <int, AuxiliaryMaterialDataTable> AuxiliaryMaterialList =
                AuxiliaryMaterial.getInctance().getAuxiliaryListFromTableName("BASE_UNIT_LIST");

            SortedDictionary <int, AuxiliaryMaterialDataTable> AuxiliaryStorelList =
                AuxiliaryMaterial.getInctance().getAuxiliaryListFromTableName("BASE_STORAGE_LIST");

            SortedDictionary <int, AuxiliaryMaterialDataTable> AuxiliaryAttributelList =
                AuxiliaryMaterial.getInctance().getAuxiliaryListFromTableName("BASE_MATERIEL_ATTRIBUTE");


            for (int i = 0; i < materielList.Count; i++)
            {
                MaterielTable materiel = new MaterielTable();
                materiel = (MaterielTable)materielList[i];

                ArrayList temp = new ArrayList();

                temp.Add(materiel.pkey);
                temp.Add(materiel.name);
                temp.Add(materiel.num);
                temp.Add(MaterielType.getInctance().getMaterielTypeNameFromPkey(materiel.materielType));
                temp.Add(materiel.model);
                temp.Add(materiel.brand);

                InitMaterielTable MaterielCountdata = InitMateriel.getInctance().getMaterielInfoFromMaterielID(materiel.pkey);
                temp.Add(MaterielCountdata.value);

                if (m_isDisplayJG)
                {
                    temp.Add(MaterielCountdata.price);
                    temp.Add((double)(Math.Round(MaterielCountdata.value * MaterielCountdata.price * 100)) / 100);
                }

                if (m_materielProlist.ContainsKey(materiel.pkey))
                {
                    MaterielProOccupiedInfo proOccupiedRecord = new MaterielProOccupiedInfo();
                    proOccupiedRecord = (MaterielProOccupiedInfo)m_materielProlist[materiel.pkey];

                    temp.Add(proOccupiedRecord.sum);
                    temp.Add(proOccupiedRecord.applyStaffName);
                    temp.Add(MaterielCountdata.value - proOccupiedRecord.sum);
                }
                else
                {
                    temp.Add(0);
                    temp.Add("-");
                    temp.Add(MaterielCountdata.value);
                }

                if (AuxiliaryMaterialList.ContainsKey(materiel.unit))
                {
                    temp.Add(AuxiliaryMaterialList[materiel.unit].name);
                }
                else
                {
                    temp.Add("");
                }

                temp.Add(materiel.materielParameter);
                temp.Add(materiel.CZ);
                temp.Add(materiel.max);
                temp.Add(materiel.min);
                temp.Add(materiel.warramty);

                if (AuxiliaryStorelList.ContainsKey(materiel.storage))
                {
                    temp.Add(AuxiliaryStorelList[materiel.storage].name);
                }
                else
                {
                    temp.Add("");
                }

                string materielAttributeName = "";
                if (AuxiliaryAttributelList.ContainsKey(materiel.materielAttribute))
                {
                    materielAttributeName = AuxiliaryAttributelList[materiel.materielAttribute].name;
                }

                if (m_displayDataType == (int)DisplayDataType.Materiel)
                {
                    if (materielAttributeName.IndexOf("外购") != -1)
                    {
                        materiels.Add(materiels.Count, temp);
                        sum += MaterielCountdata.value * MaterielCountdata.price;
                    }
                }
                else if (m_displayDataType == (int)DisplayDataType.Product)
                {
                    if (materielAttributeName.IndexOf("外购") == -1)
                    {
                        materiels.Add(materiels.Count, temp);
                        sum += MaterielCountdata.value * MaterielCountdata.price;
                    }
                }
                else
                {
                    materiels.Add(materiels.Count, temp);
                    sum += MaterielCountdata.value * MaterielCountdata.price;
                }
            }

            // 金额信息保留2位小数儿
            sum = (double)(Math.Round(sum * 100)) / 100;

            if (m_isDisplayJG)
            {
                m_dataGridViewExtend.initDataGridViewData(materiels, 8);
            }
            else
            {
                m_dataGridViewExtend.initDataGridViewData(materiels, 6);
            }

            this.dataGridViewMaterielList.Columns[1].DefaultCellStyle.BackColor = System.Drawing.Color.LightGreen;
            this.dataGridViewMaterielList.Columns[6].DefaultCellStyle.BackColor = System.Drawing.Color.LightGreen;

            if (m_isDisplayJG)
            {
                this.dataGridViewMaterielList.Columns[7].DefaultCellStyle.BackColor  = System.Drawing.Color.LightGreen;
                this.dataGridViewMaterielList.Columns[8].DefaultCellStyle.BackColor  = System.Drawing.Color.LightGreen;
                this.dataGridViewMaterielList.Columns[11].DefaultCellStyle.BackColor = System.Drawing.Color.LightGreen;

                this.labelCountInfo.Text  = "[" + m_materielGroupName + "]类材料总计[" + Convert.ToString(materiels.Count) + "]条";
                this.labelCountInfo.Text += "  累计金额[" + Convert.ToString(sum) + "]";
            }
            else
            {
                this.dataGridViewMaterielList.Columns[9].DefaultCellStyle.BackColor = System.Drawing.Color.LightGreen;
                this.labelCountInfo.Text = "[" + m_materielGroupName + "]类材料总计[" + Convert.ToString(materiels.Count) + "]条";
            }
        }