private void writeBillDetailsInfoFromBillNumber(string billNumber)
        {
            // DataGridView 赋值
            SortedDictionary <int, PurchaseApplyOrderDetailsTable> purchaseOrderDetails =
                PurchaseApplyOrderDetails.getInctance().getPurchaseInfoFromBillNumber(billNumber);

            foreach (KeyValuePair <int, PurchaseApplyOrderDetailsTable> index in purchaseOrderDetails)
            {
                PurchaseApplyOrderDetailsTable record = new PurchaseApplyOrderDetailsTable();
                record = index.Value;

                int rowIndex = Convert.ToInt32(record.rowNumber.ToString()) - 1;

                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.MatetielNumber].Value     = record.materielID;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.MatetielName].Value       = record.materielName;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Model].Value              = record.materielModel;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Unit].Value               = record.materielUnitPurchase;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Price].Value              = record.price;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Value].Value              = record.value;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Turnover].Value           = record.sumMoney;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.TransportationCost].Value = 0;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.OtherCost].Value          = record.otherCost;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.SumTurnover].Value        = record.totalMoney;
            }
        }
Beispiel #2
0
        private void save_Click(object sender, EventArgs e)
        {
            m_isSaveSuccess = false;

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

            this.ActiveControl = this.toolStrip1;

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

            if (dataList.Count > 0)
            {
                // 采购订单表头和表尾信息
                PurchaseApplyOrderTable record = getPurchaseApplyOrderValue();
                if (purchaseOrderIsFull(record) && purchaseOrderDetailsIsFull(dataList))
                {
                    PurchaseApplyOrder.getInctance().insert(record, false);
                    PurchaseApplyOrderDetails.getInctance().insert(dataList);
                    BillNumber.getInctance().inserBillNumber(BillTypeNumber, this.labelTradingDate.Text, this.labelBillNumber.Text.ToString());

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

                    this.Close();
                }
            }
            else
            {
                MessageBoxExtend.messageWarning("此单据不包含任何交易信息,单据保存失败.");
            }
        }
Beispiel #3
0
        private void readBillInfoToUI()
        {
            // 单据表头表尾信息
            m_purchaseOrder = PurchaseApplyOrder.getInctance().getPurchaseInfoFromBillNumber(m_billNumber);

            m_applyStaffPkey = m_purchaseOrder.applyId;

            this.labelPurchaseName.Visible    = true;
            this.labelTradingDate.Visible     = true;
            this.labelBillNumber.Visible      = true;
            this.labelProject.Visible         = true;
            this.labelDeliveryDate.Visible    = true;
            this.labelSummary.Visible         = true;
            this.labelMakeBillStaff.Visible   = true;
            this.labelReviewBillStaff.Visible = true;
            this.labelReviewDate.Visible      = true;

            this.labelPurchaseName.Text  = m_purchaseOrder.applyName;
            this.labelTradingDate.Text   = m_purchaseOrder.tradingDate;
            this.labelBillNumber.Text    = m_purchaseOrder.billNumber;
            this.labelDeliveryDate.Text  = m_purchaseOrder.paymentDate;
            this.labelProject.Text       = m_purchaseOrder.srcOrderNum;
            this.labelSummary.Text       = m_purchaseOrder.exchangesUnit;
            this.labelMakeBillStaff.Text = m_purchaseOrder.makeOrderStaffName;

            // DataGridView 赋值
            SortedDictionary <int, PurchaseApplyOrderDetailsTable> purchaseOrderDetails =
                PurchaseApplyOrderDetails.getInctance().getPurchaseInfoFromBillNumber(m_billNumber);

            foreach (KeyValuePair <int, PurchaseApplyOrderDetailsTable> index in purchaseOrderDetails)
            {
                PurchaseApplyOrderDetailsTable record = new PurchaseApplyOrderDetailsTable();
                record = index.Value;

                int rowIndex = Convert.ToInt32(record.rowNumber.ToString()) - 1;

                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.MatetielNumber].Value        = record.materielID;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.MatetielName].Value          = record.materielName;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Brand].Value                 = record.brand;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Model].Value                 = record.materielModel;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Parameter].Value             = record.parameter;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Unit].Value                  = record.materielUnitPurchase;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Price].Value                 = record.price;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Value].Value                 = record.value;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Turnover].Value              = record.sumMoney;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.OtherCost].Value             = record.otherCost;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.SumTurnover].Value           = record.totalMoney;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.xxMatetielTableRowNum].Value = record.xxMatetielTableRowNum;
            }

            // 如果单据已审核,则禁用页面所有控件
            if (m_purchaseOrder.isReview == "1")
            {
                this.labelReviewBillStaff.Text = m_purchaseOrder.orderrReviewName;
                this.labelReviewDate.Text      = m_purchaseOrder.reviewDate;
                this.panelIsReview.Visible     = true;

                this.save.Enabled = false;
                this.toolStripButtonReview.Enabled  = false;
                this.dataGridViewDataList.ReadOnly  = true;
                this.dataGridViewDataCount.ReadOnly = true;

                this.panelPurchaseName.Visible = false;
                this.panelTradingDate.Visible  = false;
                this.panelProjectNum.Visible   = false;
                this.panelDeliveryDate.Visible = false;
                this.panelSummary.Visible      = false;

                this.textBoxPApplyName.Visible          = false;
                this.textBoxProject.Visible             = false;
                this.dateTimePickerTradingDate.Visible  = false;
                this.dateTimePickerDeliveryDate.Visible = false;
                this.textBoxSummary.Visible             = false;
            }
            else
            {
                this.labelReviewBillStaff.Visible = false;
                this.labelReviewDate.Visible      = false;
            }
        }
        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);
                }
            }
        }
Beispiel #6
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) + "]条数据";
        }