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);
            }
        }
Beispiel #2
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) + "]条数据";
        }