public FormProjectMaterielChangeOrder(string billNumber)
        {
            InitializeComponent();

            //注:页面因素中数据表类型(1:设备总材料表;2:电器总材料表;3:工程总材料表)
            m_currentOrderInfo = FormProjectInfoChange.getInctance().getProjectInfoFromBillNumber(billNumber);
            m_tablesType = m_currentOrderInfo.dataType;

            if (m_tablesType == 1)
            {
                this.labelName.Text = "设备总材料变更申请表";
                this.Text = "设备总材料变更申请表";
            }
            else if (m_tablesType == 2)
            {
                this.labelName.Text = "电器总材料变更申请表";
                this.Text = "电器总材料变更申请表";
            }
            else if (m_tablesType == 3)
            {
                this.labelName.Text = "工程总材料变更申请表";
                this.Text = "工程总材料变更申请表";
            }
            else
            {
                m_tablesType = 1;
                this.labelName.Text = "设备总材料变更申请表";
                this.Text = "设备总材料变更申请表";
            }
            m_billNumber = billNumber;
        }
        private void save_Click(object sender, EventArgs e)
        {
            m_isSaveSuccessFul = false;

            if ((sender.ToString() == "保存" || sender.ToString() == "审核") &&
                FormProjectInfoChange.getInctance().checkBillIsReview(this.labelBillNumber.Text.ToString()))
            {
                MessageBoxExtend.messageWarning("单据已被审核,所有数据无法进行更改,无法重复保存或审核\r\n请重新登录或手动刷新后查看单据详情");
                return;
            }

            this.ActiveControl = this.toolStrip1;

            // 得到详细的采购信息
            ArrayList dataList = getOrderDetailsValue();

            if (dataList.Count > 0)
            {
                // 采购订单表头和表尾信息
                geTableHadeAndEndValue();

                if (purchaseOrderIsFull(m_currentOrderInfo) && purchaseOrderDetailsIsFull(dataList))
                {
                    FormProjectInfoChange.getInctance().insert(m_currentOrderInfo, false);
                    ProjectManagerDetails.getInctance().insert(dataList);
                    BillNumber.getInctance().inserBillNumber(BillTypeNumber, this.labelMakeDate.Text, this.labelBillNumber.Text.ToString());

                    if (m_billNumber.Length == 0)
                    {
                        MessageBoxExtend.messageOK("数据保存成功");
                    }

                    m_isSaveSuccessFul = true;

                    this.Close();
                }
            }
            else
            {
                MessageBoxExtend.messageWarning("此单据不包含任何交易信息,单据保存失败.");
            }
        }
        private void toolStripButtonReview_Click(object sender, EventArgs e)
        {
            try
            {
                if (m_billNumber.Length > 0)
                {
                    save_Click(sender, e);

                    if (m_isSaveSuccessFul)
                    {
                        FormProjectInfoChange.getInctance().billReview(this.labelBillNumber.Text);
                        MessageBoxExtend.messageOK("单据审核成功");
                    }

                }
            }
            catch (Exception exp)
            {
                MessageBoxExtend.messageError(exp.ToString());
            }
        }
Example #4
0
        private void exportProjectInfoChangeData()
        {
            int startRowIndex1 = 8;
            int startRowIndex2 = 22;

            // 总材料表套打
            FormProjectMaterielChangeTable projectInfoChange = FormProjectInfoChange.getInctance().getProjectInfoFromBillNumber(m_billNubmber);
            FormProjectMaterielTable       projectInfo       = FormProject.getInctance().getProjectInfoFromBillNumber(projectInfoChange.srcBillNumber);

            int    dataType = FormProject.getInctance().getOrderTypeFromBillNumber(projectInfoChange.srcBillNumber);
            string type     = "设备";

            if (dataType == 1)
            {
                type = "设备";
            }
            else if (dataType == 2)
            {
                type = "电器";
            }
            else if (dataType == 3)
            {
                type = "工程";
            }

            stringReplace(type, "[1]");
            stringReplace(projectInfo.billNumber, "[2]");
            stringReplace(projectInfoChange.billNumber, "[3]");
            stringReplace(projectInfo.projectName, "[4]");
            stringReplace(projectInfo.projectNum, "[5]");
            stringReplace(projectInfo.makeNum, "[6]");
            stringReplace(projectInfo.deviceMode, "[7]");
            stringReplace(projectInfoChange.makeOrderDate, "[8]");
            stringReplace(projectInfoChange.makeOrderStaffName, "[9]");
            stringReplace(projectInfo.subName, "[10]");

            // 变更后数据
            for (int row2 = 0; row2 < m_dataGridView.RowCount; row2++)
            {
                if (m_dataGridView.Rows[row2].Cells[(int)FormProjectMaterielChangeOrder.DataGridColumnName.MatetielNumber].Value.ToString().Length == 0)
                {
                    break;
                }

                m_excelApp.Cells[row2 + startRowIndex2, 1]  = m_dataGridView.Rows[row2].Cells[(int)FormProjectMaterielChangeOrder.DataGridColumnName.Num].Value.ToString().Trim();
                m_excelApp.Cells[row2 + startRowIndex2, 2]  = m_dataGridView.Rows[row2].Cells[(int)FormProjectMaterielChangeOrder.DataGridColumnName.Sequence].Value.ToString().Trim();
                m_excelApp.Cells[row2 + startRowIndex2, 3]  = m_dataGridView.Rows[row2].Cells[(int)FormProjectMaterielChangeOrder.DataGridColumnName.DeviceName].Value.ToString().Trim();
                m_excelApp.Cells[row2 + startRowIndex2, 4]  = m_dataGridView.Rows[row2].Cells[(int)FormProjectMaterielChangeOrder.DataGridColumnName.MatetielName].Value.ToString().Trim();
                m_excelApp.Cells[row2 + startRowIndex2, 5]  = m_dataGridView.Rows[row2].Cells[(int)FormProjectMaterielChangeOrder.DataGridColumnName.CL].Value.ToString().Trim();
                m_excelApp.Cells[row2 + startRowIndex2, 6]  = m_dataGridView.Rows[row2].Cells[(int)FormProjectMaterielChangeOrder.DataGridColumnName.Model].Value.ToString().Trim();
                m_excelApp.Cells[row2 + startRowIndex2, 7]  = m_dataGridView.Rows[row2].Cells[(int)FormProjectMaterielChangeOrder.DataGridColumnName.Size].Value.ToString().Trim();
                m_excelApp.Cells[row2 + startRowIndex2, 8]  = m_dataGridView.Rows[row2].Cells[(int)FormProjectMaterielChangeOrder.DataGridColumnName.Parameter].Value.ToString().Trim();
                m_excelApp.Cells[row2 + startRowIndex2, 9]  = m_dataGridView.Rows[row2].Cells[(int)FormProjectMaterielChangeOrder.DataGridColumnName.Unit].Value.ToString().Trim();
                m_excelApp.Cells[row2 + startRowIndex2, 10] = m_dataGridView.Rows[row2].Cells[(int)FormProjectMaterielChangeOrder.DataGridColumnName.Value].Value.ToString().Trim();
                m_excelApp.Cells[row2 + startRowIndex2, 11] = m_dataGridView.Rows[row2].Cells[(int)FormProjectMaterielChangeOrder.DataGridColumnName.Brand].Value.ToString().Trim();
                m_excelApp.Cells[row2 + startRowIndex2, 12] = m_dataGridView.Rows[row2].Cells[(int)FormProjectMaterielChangeOrder.DataGridColumnName.Note].Value.ToString().Trim();
            }

            // 变更前数据
            if (m_dataGridViewOfter == null)
            {
                return;
            }

            for (int row = 0; row < m_dataGridViewOfter.RowCount; row++)
            {
                if (m_dataGridViewOfter.Rows[row].Cells[(int)FormProjectMaterielChangeOrder.DataGridColumnName.MatetielNumber].Value.ToString().Length == 0)
                {
                    break;
                }

                m_excelApp.Cells[row + startRowIndex1, 1]  = m_dataGridViewOfter.Rows[row].Cells[(int)FormProjectMaterielChangeOrder.DataGridColumnName.Num].Value.ToString().Trim();
                m_excelApp.Cells[row + startRowIndex1, 2]  = m_dataGridViewOfter.Rows[row].Cells[(int)FormProjectMaterielChangeOrder.DataGridColumnName.Sequence].Value.ToString().Trim();
                m_excelApp.Cells[row + startRowIndex1, 3]  = m_dataGridViewOfter.Rows[row].Cells[(int)FormProjectMaterielChangeOrder.DataGridColumnName.DeviceName].Value.ToString().Trim();
                m_excelApp.Cells[row + startRowIndex1, 4]  = m_dataGridViewOfter.Rows[row].Cells[(int)FormProjectMaterielChangeOrder.DataGridColumnName.MatetielName].Value.ToString().Trim();
                m_excelApp.Cells[row + startRowIndex1, 5]  = m_dataGridViewOfter.Rows[row].Cells[(int)FormProjectMaterielChangeOrder.DataGridColumnName.CL].Value.ToString().Trim();
                m_excelApp.Cells[row + startRowIndex1, 6]  = m_dataGridViewOfter.Rows[row].Cells[(int)FormProjectMaterielChangeOrder.DataGridColumnName.Model].Value.ToString().Trim();
                m_excelApp.Cells[row + startRowIndex1, 7]  = m_dataGridViewOfter.Rows[row].Cells[(int)FormProjectMaterielChangeOrder.DataGridColumnName.Size].Value.ToString().Trim();
                m_excelApp.Cells[row + startRowIndex1, 8]  = m_dataGridViewOfter.Rows[row].Cells[(int)FormProjectMaterielChangeOrder.DataGridColumnName.Parameter].Value.ToString().Trim();
                m_excelApp.Cells[row + startRowIndex1, 9]  = m_dataGridViewOfter.Rows[row].Cells[(int)FormProjectMaterielChangeOrder.DataGridColumnName.Unit].Value.ToString().Trim();
                m_excelApp.Cells[row + startRowIndex1, 10] = m_dataGridViewOfter.Rows[row].Cells[(int)FormProjectMaterielChangeOrder.DataGridColumnName.Value].Value.ToString().Trim();
                m_excelApp.Cells[row + startRowIndex1, 11] = m_dataGridViewOfter.Rows[row].Cells[(int)FormProjectMaterielChangeOrder.DataGridColumnName.Brand].Value.ToString().Trim();
                m_excelApp.Cells[row + startRowIndex1, 12] = m_dataGridViewOfter.Rows[row].Cells[(int)FormProjectMaterielChangeOrder.DataGridColumnName.Note].Value.ToString().Trim();
            }
        }
        private void getInfoListFromBillNumber(FormProjectMaterielTable record)
        {
            SortedDictionary <int, ProjectManagerDetailsTable> listDetails = new SortedDictionary <int, ProjectManagerDetailsTable>();

            listDetails = ProjectManagerDetails.getInctance().getPurchaseInfoFromBillNumber(record.billNumber);

            SortedDictionary <int, ProjectManagerDetailsTable> changeMaterielList = FormProjectInfoChange.getInctance().getMaterielDetailsFromSrcBillNumber(record.billNumber);

            for (int index2 = 0; index2 < listDetails.Count; index2++)
            {
                ProjectManagerDetailsTable tmp = new ProjectManagerDetailsTable();
                tmp = (ProjectManagerDetailsTable)listDetails[index2];

                // 物料数量可能会存在变更,若发生变更,需要使用变更后数量代替原有数量,在一个材料表中,序号是唯一值
                double actualValue = 0.0;
                int    sign        = 0;
                if (tmp.no.Length > 0)
                {
                    sign = Convert.ToInt32(tmp.no);
                }

                if (changeMaterielList.Count > 0 && changeMaterielList.ContainsKey(sign))
                {
                    if (tmp.materielID != changeMaterielList[sign].materielID)
                    {
                        // 相当于变更时,使用使用了另外一种物料替换了现有物料,
                        tmp.materielID        = changeMaterielList[sign].materielID;
                        tmp.materielName      = changeMaterielList[sign].materielName;
                        tmp.num               = changeMaterielList[sign].num;
                        tmp.materielModel     = changeMaterielList[sign].materielModel;
                        tmp.materielParameter = changeMaterielList[sign].materielParameter;
                        tmp.cl           = changeMaterielList[sign].cl;
                        tmp.materielSize = changeMaterielList[sign].materielSize;
                    }

                    actualValue = changeMaterielList[sign].value;
                    changeMaterielList.Remove(sign);
                }
                else
                {
                    actualValue = tmp.value;
                }

                ArrayList temp = new ArrayList();

                temp.Add(record.billNumber);
                temp.Add(record.projectNum);
                temp.Add(record.makeNum);
                temp.Add(record.deviceMode);
                temp.Add(record.subName);

                temp.Add(tmp.materielID);
                temp.Add(tmp.materielName);
                temp.Add(tmp.num);
                temp.Add(tmp.materielModel);
                temp.Add(tmp.materielParameter);
                temp.Add(tmp.cl);
                temp.Add(tmp.materielSize);
                temp.Add(actualValue);

                // 得到实际库存
                InitMaterielTable MaterielCountdata = InitMateriel.getInctance().getMaterielInfoFromMaterielID(tmp.materielID);
                temp.Add(MaterielCountdata.value);

                // 库存预占情况,包含总预占量和本项目预占量
                temp.Add(MaterielProOccupiedOrderDetails.getInctance().getMaterielProCountInfoFromProject(tmp.materielID));
                temp.Add(MaterielProOccupiedOrderDetails.getInctance().getMaterielProCountInfoFromProject(tmp.materielID, record.billNumber));


                // 转采购申请单数量
                double appylyCount = PurchaseApplyOrderDetails.getInctance().getPurchaseValueFromProjectNumber(record.billNumber,
                                                                                                               PublicFuction.getXXMateaielOrderSign(tmp.rowNumber, tmp.sequence, tmp.no));
                temp.Add(appylyCount);

                // 采购订单数量
                SortedDictionary <int, PurchaseOrderTable> listOrderList = new SortedDictionary <int, PurchaseOrderTable>();
                listOrderList = PurchaseOrder.getInctance().getAllPurchaseOrderInfoFromProjectNum(record.billNumber);

                double orderCount = 0;
                for (int indexOrderList = 0; indexOrderList < listOrderList.Count; indexOrderList++)
                {
                    PurchaseOrderTable recordOrder = new PurchaseOrderTable();
                    recordOrder = (PurchaseOrderTable)listOrderList[indexOrderList];

                    orderCount += PurchaseOrderDetails.getInctance().getPurchaseValueFromBillNumber(recordOrder.billNumber, tmp.materielID);
                }
                temp.Add(orderCount);

                // 采购入库数量
                SortedDictionary <int, PurchaseInOrderTable> purchaseInOrderList = new SortedDictionary <int, PurchaseInOrderTable>();
                purchaseInOrderList = PurchaseInOrder.getInctance().getAllPurchaseOrderInfoFromProjectNum(record.billNumber);

                double purchaseInOrderValueCount = 0;
                for (int indexOrderList = 0; indexOrderList < purchaseInOrderList.Count; indexOrderList++)
                {
                    PurchaseInOrderTable recordOrder = new PurchaseInOrderTable();
                    recordOrder = (PurchaseInOrderTable)purchaseInOrderList[indexOrderList];

                    purchaseInOrderValueCount += PurchaseInOrderDetails.getInctance().getPurchaseValueFromBillNumber(recordOrder.billNumber, tmp.materielID);
                }
                temp.Add(purchaseInOrderValueCount);

                // 生产领料数量
                double materielOutOrderValueCount = MaterielOutOrderDetails.getInctance().getMaterielCountInfoFromProject(record.billNumber,
                                                                                                                          PublicFuction.getXXMateaielOrderSign(tmp.rowNumber, tmp.sequence, tmp.no));
                temp.Add(materielOutOrderValueCount);

                m_projectInfoList.Add(m_projectInfoList.Count, temp);
            }

            // 如果changeMaterielList.count大于0 则代表有
            foreach (KeyValuePair <int, ProjectManagerDetailsTable> index3 in changeMaterielList)
            {
                ProjectManagerDetailsTable tmp = new ProjectManagerDetailsTable();
                tmp = index3.Value;

                ArrayList temp = new ArrayList();

                temp.Add(record.billNumber);
                temp.Add(record.projectNum);
                temp.Add(record.makeNum);
                temp.Add(record.deviceMode);
                temp.Add(record.subName);

                temp.Add(tmp.materielID);
                temp.Add(tmp.materielName);
                temp.Add(tmp.num);
                temp.Add(tmp.materielModel);
                temp.Add(tmp.materielParameter);
                temp.Add(tmp.cl);
                temp.Add(tmp.materielSize);
                temp.Add(tmp.value);

                // 得到实际库存
                InitMaterielTable MaterielCountdata = InitMateriel.getInctance().getMaterielInfoFromMaterielID(tmp.materielID);
                temp.Add(MaterielCountdata.value);

                // 库存预占情况,包含总预占量和本项目预占量
                temp.Add(MaterielProOccupiedOrderDetails.getInctance().getMaterielProCountInfoFromProject(tmp.materielID));
                temp.Add(MaterielProOccupiedOrderDetails.getInctance().getMaterielProCountInfoFromProject(tmp.materielID, record.billNumber));


                // 转采购申请单数量
                double appylyCount = PurchaseApplyOrderDetails.getInctance().getPurchaseValueFromProjectNumber(record.billNumber,
                                                                                                               PublicFuction.getXXMateaielOrderSign(tmp.rowNumber, tmp.sequence, tmp.no));
                temp.Add(appylyCount);

                // 采购订单数量
                SortedDictionary <int, PurchaseOrderTable> listOrderList = new SortedDictionary <int, PurchaseOrderTable>();
                listOrderList = PurchaseOrder.getInctance().getAllPurchaseOrderInfoFromProjectNum(record.billNumber);

                double orderCount = 0;
                for (int indexOrderList = 0; indexOrderList < listOrderList.Count; indexOrderList++)
                {
                    PurchaseOrderTable recordOrder = new PurchaseOrderTable();
                    recordOrder = (PurchaseOrderTable)listOrderList[indexOrderList];

                    orderCount += PurchaseOrderDetails.getInctance().getPurchaseValueFromBillNumber(recordOrder.billNumber, tmp.materielID);
                }
                temp.Add(orderCount);

                // 采购入库数量
                SortedDictionary <int, PurchaseInOrderTable> purchaseInOrderList = new SortedDictionary <int, PurchaseInOrderTable>();
                purchaseInOrderList = PurchaseInOrder.getInctance().getAllPurchaseOrderInfoFromProjectNum(record.billNumber);

                double purchaseInOrderValueCount = 0;
                for (int indexOrderList = 0; indexOrderList < purchaseInOrderList.Count; indexOrderList++)
                {
                    PurchaseInOrderTable recordOrder = new PurchaseInOrderTable();
                    recordOrder = (PurchaseInOrderTable)purchaseInOrderList[indexOrderList];

                    purchaseInOrderValueCount += PurchaseInOrderDetails.getInctance().getPurchaseValueFromBillNumber(recordOrder.billNumber, tmp.materielID);
                }
                temp.Add(purchaseInOrderValueCount);

                // 生产领料数量
                double materielOutOrderValueCount = MaterielOutOrderDetails.getInctance().getMaterielCountInfoFromProject(record.billNumber,
                                                                                                                          PublicFuction.getXXMateaielOrderSign(tmp.rowNumber, tmp.sequence, tmp.no));
                temp.Add(materielOutOrderValueCount);

                m_projectInfoList.Add(m_projectInfoList.Count, temp);
            }
        }
        private void updateDataGridView()
        {
            SortedDictionary <int, ArrayList> sortedDictionaryList = new SortedDictionary <int, ArrayList>();

            if (m_orderType == OrderType.PurchaseApplyOrder)
            {
                SortedDictionary <int, PurchaseApplyOrderTable> list = new SortedDictionary <int, PurchaseApplyOrderTable>();

                SortedDictionary <int, PurchaseApplyOrderTable> listOrderList = new SortedDictionary <int, PurchaseApplyOrderTable>();
                listOrderList = PurchaseApplyOrder.getInctance().getAllPurchaseOrderInfoFromProjectNum(m_xxMaterielTableNum);

                for (int indexOrderList = 0; indexOrderList < listOrderList.Count; indexOrderList++)
                {
                    PurchaseApplyOrderTable recordOrder = new PurchaseApplyOrderTable();
                    recordOrder = (PurchaseApplyOrderTable)listOrderList[indexOrderList];

                    if (PurchaseApplyOrderDetails.getInctance().getPurchaseValueFromMaterielID(recordOrder.billNumber, m_materielID) > 0)
                    {
                        list.Add(list.Count, recordOrder);
                    }
                }

                m_dataGridRecordCount = list.Count;

                for (int index = 0; index < list.Count; index++)
                {
                    PurchaseApplyOrderTable record = new PurchaseApplyOrderTable();
                    record = (PurchaseApplyOrderTable)list[index];

                    ArrayList temp = new ArrayList();

                    temp.Add(record.pkey);
                    temp.Add(record.applyName);
                    temp.Add(record.tradingDate);
                    temp.Add(record.billNumber);
                    temp.Add(record.srcOrderNum);
                    temp.Add(record.paymentDate);
                    temp.Add(record.totalMoney);
                    temp.Add(record.makeOrderStaffName);

                    if (record.isReview == "0")
                    {
                        temp.Add("否");
                    }
                    else
                    {
                        temp.Add("是");
                    }

                    temp.Add(record.orderrReviewName);
                    temp.Add(record.reviewDate);

                    sortedDictionaryList.Add(sortedDictionaryList.Count, temp);
                }

                m_dateGridViewExtend.initDataGridViewData(sortedDictionaryList, 3);
            }
            else if (m_orderType == OrderType.PurchaseOrder)
            {
                SortedDictionary <int, PurchaseOrderTable> list = new SortedDictionary <int, PurchaseOrderTable>();

                SortedDictionary <int, PurchaseOrderTable> listOrderList = new SortedDictionary <int, PurchaseOrderTable>();
                listOrderList = PurchaseOrder.getInctance().getAllPurchaseOrderInfoFromProjectNum(m_xxMaterielTableNum);

                for (int indexOrderList = 0; indexOrderList < listOrderList.Count; indexOrderList++)
                {
                    PurchaseOrderTable recordOrder = new PurchaseOrderTable();
                    recordOrder = (PurchaseOrderTable)listOrderList[indexOrderList];

                    if (PurchaseOrderDetails.getInctance().getPurchaseValueFromBillNumber(recordOrder.billNumber, m_materielID) > 0)
                    {
                        list.Add(list.Count, recordOrder);
                    }
                }

                m_dataGridRecordCount = list.Count;

                for (int index = 0; index < list.Count; index++)
                {
                    PurchaseOrderTable record = new PurchaseOrderTable();
                    record = (PurchaseOrderTable)list[index];

                    ArrayList temp = new ArrayList();

                    temp.Add(record.pkey);
                    temp.Add(record.supplierName);
                    temp.Add(record.tradingDate);
                    temp.Add(record.billNumber);
                    temp.Add(record.xxMaterielTableNum);
                    temp.Add(record.deliveryDate);
                    temp.Add(record.paymentDate);
                    temp.Add(record.sumMoney);
                    temp.Add(record.sumTransportationCost);
                    temp.Add(record.sumOtherCost);
                    temp.Add(record.totalMoney);
                    temp.Add(record.businessPeopleName);
                    temp.Add(record.makeOrderStaffName);

                    if (record.isReview == "0")
                    {
                        temp.Add("否");
                    }
                    else
                    {
                        temp.Add("是");
                    }

                    temp.Add(record.orderrReviewName);
                    temp.Add(record.reviewDate);

                    sortedDictionaryList.Add(sortedDictionaryList.Count, temp);
                }

                m_dateGridViewExtend.initDataGridViewData(sortedDictionaryList, 3);
            }
            else if (m_orderType == OrderType.PurchaseIn)
            {
                SortedDictionary <int, PurchaseInOrderTable> list = new SortedDictionary <int, PurchaseInOrderTable>();

                SortedDictionary <int, PurchaseInOrderTable> listOrderList = new SortedDictionary <int, PurchaseInOrderTable>();
                listOrderList = PurchaseInOrder.getInctance().getAllPurchaseOrderInfoFromProjectNum(m_xxMaterielTableNum);

                for (int indexOrderList = 0; indexOrderList < listOrderList.Count; indexOrderList++)
                {
                    PurchaseInOrderTable recordOrder = new PurchaseInOrderTable();
                    recordOrder = (PurchaseInOrderTable)listOrderList[indexOrderList];

                    if (PurchaseInOrderDetails.getInctance().getPurchaseValueFromBillNumber(recordOrder.billNumber, m_materielID) > 0)
                    {
                        list.Add(list.Count, recordOrder);
                    }
                }

                m_dataGridRecordCount = list.Count;

                for (int index = 0; index < list.Count; index++)
                {
                    PurchaseInOrderTable record = new PurchaseInOrderTable();
                    record = (PurchaseInOrderTable)list[index];

                    ArrayList temp = new ArrayList();

                    temp.Add(record.pkey);
                    temp.Add(record.supplierName);
                    temp.Add(record.tradingDate);
                    temp.Add(record.billNumber);
                    temp.Add(record.purchaseType);
                    temp.Add(record.srcOrderNum);
                    temp.Add(record.paymentDate);
                    temp.Add(record.sourceBillNumber);
                    temp.Add(record.sumMoney);
                    temp.Add(record.sumTransportationCost);
                    temp.Add(record.sumOtherCost);
                    temp.Add(record.totalMoney);
                    temp.Add(record.staffSaveName);
                    temp.Add(record.staffCheckName);
                    temp.Add(record.businessPeopleName);
                    temp.Add(record.makeOrderStaffName);
                    temp.Add(record.orderrReviewName);
                    temp.Add(record.reviewDate);
                    temp.Add(record.orderInLedgerName);
                    temp.Add(record.inLedgerDate);

                    sortedDictionaryList.Add(sortedDictionaryList.Count, temp);
                }

                m_dateGridViewExtend.initDataGridViewData(sortedDictionaryList, 3);
            }
            else if (m_orderType == OrderType.StorageMaterielOut)
            {
                SortedDictionary <int, MaterielOutOrderTable> list = new SortedDictionary <int, MaterielOutOrderTable>();

                SortedDictionary <int, MaterielOutOrderTable> listOrderList = new SortedDictionary <int, MaterielOutOrderTable>();
                listOrderList = MaterielOutOrder.getInctance().getAllPurchaseOrderInfoFromProjectNum(m_xxMaterielTableNum);

                for (int indexOrderList = 0; indexOrderList < listOrderList.Count; indexOrderList++)
                {
                    MaterielOutOrderTable recordOrder = new MaterielOutOrderTable();
                    recordOrder = (MaterielOutOrderTable)listOrderList[indexOrderList];

                    if (MaterielOutOrderDetails.getInctance().getPurchaseValueFromMaterielID(recordOrder.billNumber, m_materielID) > 0)
                    {
                        list.Add(list.Count, recordOrder);
                    }
                }

                m_dataGridRecordCount = list.Count;

                for (int index = 0; index < list.Count; index++)
                {
                    MaterielOutOrderTable record = new MaterielOutOrderTable();
                    record = (MaterielOutOrderTable)list[index];

                    ArrayList temp = new ArrayList();

                    temp.Add(record.pkey);
                    temp.Add(record.departmentName);
                    temp.Add(record.tradingDate);
                    temp.Add(record.billNumber);
                    temp.Add(record.srcOrderNum);
                    temp.Add(record.makeNo);
                    temp.Add(record.sumValue);
                    temp.Add(record.sumMoney);
                    temp.Add(record.materielOutStaffName);
                    temp.Add(record.makeOrderStaffName);
                    temp.Add(record.orderrReviewName);
                    temp.Add(record.reviewDate);

                    sortedDictionaryList.Add(sortedDictionaryList.Count, temp);
                }

                m_dateGridViewExtend.initDataGridViewData(sortedDictionaryList, 3);
            }
            else if (m_orderType == OrderType.ChangeApply)
            {
                //m_dateGridViewExtend.addDataGridViewColumn("ID", 30);
                //m_dateGridViewExtend.addDataGridViewColumn("源单据号", 150);
                //m_dateGridViewExtend.addDataGridViewColumn("设计人", 80);
                //m_dateGridViewExtend.addDataGridViewColumn("单据号", 150);
                //m_dateGridViewExtend.addDataGridViewColumn("变更原因", 300);
                //m_dateGridViewExtend.addDataGridViewColumn("制单员", 80);
                //m_dateGridViewExtend.addDataGridViewColumn("审核员", 80);
                //m_dateGridViewExtend.addDataGridViewColumn("审核日期", 80);


                // 根据源单据号,得到订单详细单据
                if (m_srcChangeOrderBillNumber.Length > 0)
                {
                    SortedDictionary <int, FormProjectMaterielChangeTable> changtList = FormProjectInfoChange.getInctance().getChangeListFromSrcBillNumber(m_srcChangeOrderBillNumber);
                    m_dataGridRecordCount = changtList.Count;

                    for (int index = 0; index < changtList.Count; index++)
                    {
                        FormProjectMaterielChangeTable record = new FormProjectMaterielChangeTable();
                        record = (FormProjectMaterielChangeTable)changtList[index];

                        ArrayList temp = new ArrayList();

                        temp.Add(record.pkey);
                        temp.Add(record.srcBillNumber);
                        temp.Add(record.designStaffName);
                        temp.Add(record.billNumber);
                        temp.Add(record.changeReason);
                        temp.Add(record.makeOrderStaffName);
                        temp.Add(record.orderrReviewName);
                        temp.Add(record.reviewDate);

                        sortedDictionaryList.Add(sortedDictionaryList.Count, temp);
                    }

                    m_dateGridViewExtend.initDataGridViewData(sortedDictionaryList, 3);
                }
            }
        }
Example #7
0
        private void getProInfoList()
        {
            m_proInfoList.Clear();

            // 得到单据变更情况
            SortedDictionary <int, ProjectManagerDetailsTable> changeMaterielList = FormProjectInfoChange.getInctance().getMaterielDetailsFromSrcBillNumber(m_billNumber);

            // 根据单据,得到单据详细信息
            SortedDictionary <int, ProjectManagerDetailsTable> listDetails = new SortedDictionary <int, ProjectManagerDetailsTable>();

            listDetails = ProjectManagerDetails.getInctance().getPurchaseInfoFromBillNumber(m_billNumber);

            for (int index = 0; index < listDetails.Count; index++)
            {
                ArrayList record = new ArrayList();

                ProjectManagerDetailsTable tmp = new ProjectManagerDetailsTable();
                tmp = (ProjectManagerDetailsTable)listDetails[index];

                // 单据所需物料
                double requestValue = 0.0;
                // 已转数量
                double proValue = 0.0;

                // 物料数量可能会存在变更,若发生变更,需要使用变更后数量代替原有数量,在一个材料表中,序号是唯一值
                int sign = 0;
                if (tmp.no.Length > 0)
                {
                    sign = Convert.ToInt32(tmp.no);
                }

                if (changeMaterielList.Count > 0 && changeMaterielList.ContainsKey(sign))
                {
                    if (tmp.materielID != changeMaterielList[sign].materielID)
                    {
                        // 相当于变更时,使用使用了另外一种物料替换了现有物料,
                        tmp.materielID = changeMaterielList[sign].materielID;
                    }

                    requestValue = changeMaterielList[sign].value;
                    changeMaterielList.Remove(sign);
                }
                else
                {
                    requestValue = tmp.value;
                }


                if (m_dataType == 1)
                {
                    proValue = MaterielProOccupiedOrderDetails.getInctance().getMaterielProCountInfoFromProject(tmp.materielID, tmp.billNumber);
                }
                else if (m_dataType == 2)
                {
                    proValue = PurchaseApplyOrderDetails.getInctance().getPurchaseValueFromProjectNumber(tmp.billNumber,
                                                                                                         PublicFuction.getXXMateaielOrderSign(tmp.rowNumber, tmp.sequence, tmp.no));
                }
                else if (m_dataType == 3)
                {
                    proValue = MaterielOutOrderDetails.getInctance().getMaterielCountInfoFromProject(tmp.billNumber,
                                                                                                     PublicFuction.getXXMateaielOrderSign(tmp.rowNumber, tmp.sequence, tmp.no));
                }

                if (requestValue - proValue > 0)
                {
                    record.Add(tmp.billNumber);
                    record.Add(tmp.materielID);
                    record.Add(requestValue);
                    record.Add(proValue);

                    // 库存预占情况,本项目预占量
                    record.Add(MaterielProOccupiedOrderDetails.getInctance().getMaterielProCountInfoFromProject(tmp.materielID));
                    record.Add(MaterielProOccupiedOrderDetails.getInctance().getMaterielProCountInfoFromProject(tmp.materielID, tmp.billNumber));

                    // 得到实际库存
                    InitMaterielTable MaterielCountdata = InitMateriel.getInctance().getMaterielInfoFromMaterielID(tmp.materielID);
                    record.Add(MaterielCountdata.value);

                    // 使用行号+序列号+序号的和作为一行数据的唯一标识
                    record.Add(PublicFuction.getXXMateaielOrderSign(tmp.rowNumber, tmp.sequence, tmp.no));

                    m_proInfoList.Add(m_proInfoList.Count, record);
                }
            }

            foreach (KeyValuePair <int, ProjectManagerDetailsTable> index3 in changeMaterielList)
            {
                ArrayList record1 = new ArrayList();

                ProjectManagerDetailsTable tmp1 = new ProjectManagerDetailsTable();
                tmp1 = index3.Value;

                // 单据需要的数量
                double requestValue1 = tmp1.value;

                // 已转数量
                double proValue1 = 0.0;

                if (m_dataType == 1)
                {
                    proValue1 = MaterielProOccupiedOrderDetails.getInctance().getMaterielProCountInfoFromProject(tmp1.materielID,
                                                                                                                 FormProjectInfoChange.getInctance().getxxMaterielNumberFromBillNumber(tmp1.billNumber));
                }
                else if (m_dataType == 2)
                {
                    proValue1 = PurchaseApplyOrderDetails.getInctance().getPurchaseValueFromProjectNumber(
                        FormProjectInfoChange.getInctance().getxxMaterielNumberFromBillNumber(tmp1.billNumber),
                        PublicFuction.getXXMateaielOrderSign(tmp1.rowNumber, tmp1.sequence, tmp1.no));
                }
                else if (m_dataType == 3)
                {
                    proValue1 = MaterielOutOrderDetails.getInctance().getMaterielCountInfoFromProject(
                        FormProjectInfoChange.getInctance().getxxMaterielNumberFromBillNumber(tmp1.billNumber),
                        PublicFuction.getXXMateaielOrderSign(tmp1.rowNumber, tmp1.sequence, tmp1.no));
                }

                if (requestValue1 - proValue1 > 0)
                {
                    record1.Add(tmp1.billNumber);
                    record1.Add(tmp1.materielID);
                    record1.Add(tmp1.value);
                    record1.Add(proValue1);

                    // 库存预占情况,本项目预占量
                    record1.Add(MaterielProOccupiedOrderDetails.getInctance().getMaterielProCountInfoFromProject(tmp1.materielID));
                    record1.Add(MaterielProOccupiedOrderDetails.getInctance().getMaterielProCountInfoFromProject(tmp1.materielID, tmp1.billNumber));

                    // 得到实际库存
                    InitMaterielTable MaterielCountdata = InitMateriel.getInctance().getMaterielInfoFromMaterielID(tmp1.materielID);
                    record1.Add(MaterielCountdata.value);

                    // 使用行号+序列号+序号的和作为一行数据的唯一标识
                    record1.Add(PublicFuction.getXXMateaielOrderSign(tmp1.rowNumber, tmp1.sequence, tmp1.no));

                    m_proInfoList.Add(m_proInfoList.Count, record1);
                }
            }

            if (m_proInfoList.Count == 0)
            {
                this.button1.Enabled = false;
            }

            this.label1.Text += ", 共有[" + Convert.ToString(m_proInfoList.Count) + "]条数据";
        }