private void FormMaterielDetailed_Load(object sender, EventArgs e)
        {
            // 物料基本信息
            this.labelMaterielID.Text = Convert.ToString(m_materielID);
            MaterielTable record = Materiel.getInctance().getMaterielInfoFromPkey(m_materielID);

            this.labelMaterielName.Text = record.name;

            // 实际库存+预占
            InitMaterielTable MaterielCountdata = InitMateriel.getInctance().getMaterielInfoFromMaterielID(m_materielID);

            this.labelCount.Text    = Convert.ToString(MaterielCountdata.value);
            this.labelProCount.Text = Convert.ToString(MaterielProOccupiedOrderDetails.getInctance().getMaterielProCountInfoFromProject(m_materielID));

            // 材料表情况
            if (m_xxMaterielTablebillNubmber.Length > 0)
            {
                this.labelxxMaterielTableNum.Text = m_xxMaterielTablebillNubmber;

                FormProjectMaterielTable projectInfo = FormProject.getInctance().getProjectInfoFromBillNumber(m_xxMaterielTablebillNubmber);
                this.labelProjectNum.Text = projectInfo.projectNum;
                this.labelProName.Text    = projectInfo.projectName;
                this.labelDevMode.Text    = projectInfo.deviceMode;

                SortedDictionary <int, ProjectManagerDetailsTable> list =
                    ProjectManagerDetails.getInctance().getPurchaseInfoFromBillNumber(m_xxMaterielTablebillNubmber);


                foreach (KeyValuePair <int, ProjectManagerDetailsTable> index in list)
                {
                    if (index.Value.materielID == m_materielID)
                    {
                        this.labelSub.Text = index.Value.deviceName;

                        this.labelNum.Text     = index.Value.no;
                        this.labelSquence.Text = index.Value.sequence;

                        this.label1Value.Text  = Convert.ToString(index.Value.value);
                        this.labelUseDate.Text = index.Value.useDate;

                        break;
                    }
                }
            }
            else
            {
                this.labelxxMaterielTableNum.Text = "     ";
                this.labelProjectNum.Text         = "     ";
                this.labelProName.Text            = "     ";
                this.labelDevMode.Text            = "     ";
                this.labelSub.Text     = "     ";
                this.label1Value.Text  = "     ";
                this.labelUseDate.Text = "     ";
                this.labelNum.Text     = "     ";
                this.labelSquence.Text = "     ";
                this.labelUseDate.Text = "     ";
            }
        }
Esempio n. 2
0
        private void readProInfoListToUI()
        {
            for (int index = 0; index < m_proInfoList.Count; index++)
            {
                ArrayList record = new ArrayList();
                record = m_proInfoList[index];

                if (index == 0)
                {
                    this.labelTradingDate.Visible = true;
                    this.labelTradingDate.Text    = DateTime.Now.ToString("yyyy-MM-dd");

                    // 单据号
                    this.labelBillNumber.Text = BillNumber.getInctance().getNewBillNumber(BillTypeNumber, DateTime.Now.ToString("yyyy-MM-dd"));

                    // 制单人初始化
                    this.labelMakeBillStaff.Visible = true;
                    this.labelMakeBillStaff.Text    = DbPublic.getInctance().getCurrentLoginUserName();

                    // 项目编号初始
                    this.textBoxProjectNo.Visible  = false;
                    this.textBoxProjectNo.ReadOnly = true;

                    this.labelProjectNo.Visible = true;
                    this.labelProjectNo.Text    = record[0].ToString();
                    this.labelProjectNo.Visible = true;

                    // 生产编号初始化
                    FormProjectMaterielTable proInfo = FormProject.getInctance().getProjectInfoFromBillNumber(record[0].ToString());
                    this.textBoxMakeNo.Visible = false;
                    //this.textBoxMakeNo.ReadOnly = true;

                    this.labelMakeNo.Visible = true;
                    this.labelMakeNo.Text    = proInfo.makeNum;
                    this.labelMakeNo.Visible = true;

                    m_materieOutOrder.isReview = "1";
                }

                setMatetielInfoToDataGridView(Convert.ToString(record[1]), index);
                dataGridViewDataList.Rows[index].Cells[(int)DataGridColumnName.Value].Value = Convert.ToDouble(record[2]) - Convert.ToDouble(record[3]);


                string xxMatetielTableRowNum = Convert.ToString(record[7]);
                if (xxMatetielTableRowNum.Length > 0)
                {
                    ProjectManagerDetailsTable tmp = ProjectManagerDetails.getInctance().getMaterielInfoFromRowNum(record[0].ToString(), Convert.ToInt32(record[7]));
                    if (tmp.materielSize != null && tmp.materielSize.Length > 0)
                    {
                        dataGridViewDataList.Rows[index].Cells[(int)DataGridColumnName.Note].Value = "尺寸:" + tmp.materielSize;
                    }
                }

                dataGridViewDataList.Rows[index].Cells[(int)DataGridColumnName.xxMatetielTableRowNum].Value = Convert.ToString(record[7]);

                setTurnoverInfoDataGridView(index);
            }
        }
        private void save_Click(object sender, EventArgs e)
        {
            m_isSaveSuccess = false;

            if ((sender.ToString() == "保存" || sender.ToString() == "审核") &&
                FormProject.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))
                {
                    FormProject.getInctance().insert(m_currentOrderInfo, false);
                    ProjectManagerDetails.getInctance().insert(dataList);
                    BillNumber.getInctance().inserBillNumber(BillTypeNumber + m_tablesType, this.labelTradingDate.Text, this.labelBillNumber.Text.ToString());

                    m_isSaveSuccess = true;

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

                    // 自动形成库存占用
                    AutoGenerateMaterielPro(dataList);

                    this.Close();
                }
            }
            else
            {
                MessageBoxExtend.messageWarning("此单据不包含任何交易信息,单据保存失败.");
            }
        }
        private void setMatetielInfo(int rowIndex, string id, string num, string sequence)
        {
            // 根据单据编号,得到详细数据
            m_purchaseOrderDetails = ProjectManagerDetails.getInctance().getPurchaseInfoFromBillNumber(this.labelSrcOrderBillNum.Text);

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

                if (index.Value.materielID == Convert.ToInt32(id))
                {
                    if (sequence.Length > 0 && index.Value.sequence != sequence)
                    {
                        continue;
                    }

                    if (num.Length > 0 && index.Value.no != num)
                    {
                        continue;
                    }

                    dataGridViewDataListChangeOfter.Rows[rowIndex].Cells[(int)DataGridColumnName.MatetielNumber].Value = record.materielID;
                    dataGridViewDataListChangeOfter.Rows[rowIndex].Cells[(int)DataGridColumnName.Brand].Value = record.materielBrand;
                    dataGridViewDataListChangeOfter.Rows[rowIndex].Cells[(int)DataGridColumnName.MatetielName].Value = record.materielName;

                    dataGridViewDataListChangeOfter.Rows[rowIndex].Cells[(int)DataGridColumnName.Model].Value = record.materielModel;
                    dataGridViewDataListChangeOfter.Rows[rowIndex].Cells[(int)DataGridColumnName.Parameter].Value = record.materielParameter;
                    dataGridViewDataListChangeOfter.Rows[rowIndex].Cells[(int)DataGridColumnName.Size].Value = record.materielSize;
                    dataGridViewDataListChangeOfter.Rows[rowIndex].Cells[(int)DataGridColumnName.Unit].Value = record.materielUnit;
                    dataGridViewDataListChangeOfter.Rows[rowIndex].Cells[(int)DataGridColumnName.Value].Value = record.value;
                    dataGridViewDataListChangeOfter.Rows[rowIndex].Cells[(int)DataGridColumnName.MakeType].Value = record.makeType;
                    dataGridViewDataListChangeOfter.Rows[rowIndex].Cells[(int)DataGridColumnName.Note].Value = record.materielNote;

                    dataGridViewDataListChangeOfter.Rows[rowIndex].Cells[(int)DataGridColumnName.Num].Value = record.no;
                    dataGridViewDataListChangeOfter.Rows[rowIndex].Cells[(int)DataGridColumnName.Sequence].Value = record.sequence;
                    dataGridViewDataListChangeOfter.Rows[rowIndex].Cells[(int)DataGridColumnName.UseDate].Value = record.useDate;
                    dataGridViewDataListChangeOfter.Rows[rowIndex].Cells[(int)DataGridColumnName.DeviceName].Value = record.deviceName;
                    dataGridViewDataListChangeOfter.Rows[rowIndex].Cells[(int)DataGridColumnName.CL].Value = record.cl;

                    break;
                }
            }
        }
Esempio n. 5
0
        private void exportMaterielOutData()
        {
            // 生产领料单数据导出
            MaterielOutOrderTable table = new MaterielOutOrderTable();

            table = MaterielOutOrder.getInctance().getMaterielOutOrderInfoFromBillNumber(m_billNubmber);

            FormProjectMaterielTable projectInfo = FormProject.getInctance().getProjectInfoFromBillNumber(table.srcOrderNum);

            stringReplace(projectInfo.projectName, "[1]");
            stringReplace(table.billNumber, "[2]");
            stringReplace(table.srcOrderNum, "[3]");
            stringReplace(table.makeNo, "[4]");
            stringReplace(table.exchangesUnit, "[5]");
            stringReplace(projectInfo.projectNum, "[6]");
            stringReplace(table.makeOrderStaffName, "[7]");
            stringReplace(projectInfo.deviceMode, "[9]");
            stringReplace(projectInfo.subName, "[10]");

            double sum = 0.0;

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

                int           materielID = Convert.ToInt32(m_dataGridView.Rows[row].Cells[(int)FormMaterielOutOrder.DataGridColumnName.MatetielNumber].Value.ToString());
                MaterielTable record     = Materiel.getInctance().getMaterielInfoFromPkey(materielID);

                ProjectManagerDetailsTable tmp = new ProjectManagerDetailsTable();

                string xxMatetielTableRowNum = m_dataGridView.Rows[row].Cells[(int)FormMaterielOutOrder.DataGridColumnName.xxMatetielTableRowNum].Value.ToString();

                if (xxMatetielTableRowNum.Length > 0)
                {
                    tmp = ProjectManagerDetails.getInctance().getMaterielInfoFromRowNum(table.srcOrderNum, Convert.ToInt32(xxMatetielTableRowNum));
                }
                else
                {
                    tmp = ProjectManagerDetails.getInctance().getMaterielInfoFromBillNumber(table.srcOrderNum, materielID);
                }

                m_excelApp.Cells[row + 6, 1] = tmp.no;
                m_excelApp.Cells[row + 6, 2] = tmp.sequence;
                m_excelApp.Cells[row + 6, 3] = record.brand;
                m_excelApp.Cells[row + 6, 4] = record.name;
                m_excelApp.Cells[row + 6, 5] = record.model;

                m_excelApp.Cells[row + 6, 6] = tmp.cl;
                m_excelApp.Cells[row + 6, 7] = m_dataGridView.Rows[row].Cells[(int)FormMaterielOutOrder.DataGridColumnName.Unit].Value.ToString().Trim();

                m_excelApp.Cells[row + 6, 8]  = m_dataGridView.Rows[row].Cells[(int)FormMaterielOutOrder.DataGridColumnName.Value].Value.ToString().Trim();
                m_excelApp.Cells[row + 6, 9]  = AuxiliaryMaterial.getInctance().getAuxiliaryMaterialNameFromPkey("BASE_STORAGE_LIST", record.storage);
                m_excelApp.Cells[row + 6, 10] = m_dataGridView.Rows[row].Cells[(int)FormMaterielOutOrder.DataGridColumnName.Note].Value.ToString().Trim();

                sum += Convert.ToDouble(m_dataGridView.Rows[row].Cells[(int)FormMaterielOutOrder.DataGridColumnName.Value].Value.ToString());
            }

            stringReplace(Convert.ToString(sum), "[8]");
        }
        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);
            }
        }
Esempio n. 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) + "]条数据";
        }
        private void readBillInfoToUI()
        {
            m_projectNum = m_currentOrderInfo.projectNum;

            this.labelSrcOrderBillNum.Visible = true;
            this.labelBillNumber.Visible = true;
            this.labelSummary.Visible = true;

            this.labelMakeBillStaff.Visible = true;
            this.labelMakeDate.Visible = true;
            this.labelBusinessPeople.Visible = true;
            this.labelReviewBillStaff.Visible = true;
            this.labelReviewDate.Visible = true;

            this.labelSrcOrderBillNum.Text = m_currentOrderInfo.srcBillNumber;
            this.labelBillNumber.Text = m_currentOrderInfo.billNumber;

            FormProjectMaterielTable tmp = FormProject.getInctance().getProjectInfoFromBillNumber(m_currentOrderInfo.srcBillNumber);
            this.labelProjectName.Text = tmp.projectName;
            this.labelProjectNo.Text = tmp.projectNum;
            this.labelMakeNo.Text = tmp.makeNum;
            this.labelDevMode.Text = tmp.deviceMode;

            this.labelSummary.Text = m_currentOrderInfo.changeReason;

            this.labelMakeBillStaff.Text = m_currentOrderInfo.makeOrderStaffName;
            this.labelMakeDate.Text = m_currentOrderInfo.makeOrderDate;
            this.labelBusinessPeople.Text = m_currentOrderInfo.designStaffName;
            this.textBoxBusinessPeople.Text = m_currentOrderInfo.designStaffName;
            this.labelReviewBillStaff.Text = m_currentOrderInfo.orderrReviewName;
            this.labelReviewDate.Text = m_currentOrderInfo.reviewDate;

            // 变更前DataGridView 赋值
            string matetiels = m_currentOrderInfo.materielIDs;
            string[] sArray = matetiels.Split('#');
            int rowNum = 0;
            foreach (string index in sArray)
            {
                if (index.ToString().Length > 0)
                {
                    string[] list = index.Split(',');

                    if (list.Length > 1)
                    {
                        setMatetielInfo(rowNum, list[0], list[1], list[2]);
                    }
                    else
                    {
                        setMatetielInfo(rowNum, list[0], "", "");
                    }

                    rowNum++;
                }
            }

            // 变更后DataGridView 赋值
            SortedDictionary<int, ProjectManagerDetailsTable> purchaseOrderDetails =
                ProjectManagerDetails.getInctance().getPurchaseInfoFromBillNumber(m_billNumber);

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

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

                dataGridViewDataListChange.Rows[rowIndex].Cells[(int)DataGridColumnName.MatetielNumber].Value = record.materielID;
                dataGridViewDataListChange.Rows[rowIndex].Cells[(int)DataGridColumnName.Brand].Value = record.materielBrand;
                dataGridViewDataListChange.Rows[rowIndex].Cells[(int)DataGridColumnName.MatetielName].Value = record.materielName;

                dataGridViewDataListChange.Rows[rowIndex].Cells[(int)DataGridColumnName.Model].Value = record.materielModel;
                dataGridViewDataListChange.Rows[rowIndex].Cells[(int)DataGridColumnName.Parameter].Value = record.materielParameter;
                dataGridViewDataListChange.Rows[rowIndex].Cells[(int)DataGridColumnName.Size].Value = record.materielSize;
                dataGridViewDataListChange.Rows[rowIndex].Cells[(int)DataGridColumnName.Unit].Value = record.materielUnit;
                dataGridViewDataListChange.Rows[rowIndex].Cells[(int)DataGridColumnName.Value].Value = record.value;
                dataGridViewDataListChange.Rows[rowIndex].Cells[(int)DataGridColumnName.MakeType].Value = record.makeType;
                dataGridViewDataListChange.Rows[rowIndex].Cells[(int)DataGridColumnName.Note].Value = record.materielNote;


                dataGridViewDataListChange.Rows[rowIndex].Cells[(int)DataGridColumnName.Num].Value = record.no;
                dataGridViewDataListChange.Rows[rowIndex].Cells[(int)DataGridColumnName.Sequence].Value = record.sequence;
                dataGridViewDataListChange.Rows[rowIndex].Cells[(int)DataGridColumnName.UseDate].Value = record.useDate;
                dataGridViewDataListChange.Rows[rowIndex].Cells[(int)DataGridColumnName.DeviceName].Value = record.deviceName;
                dataGridViewDataListChange.Rows[rowIndex].Cells[(int)DataGridColumnName.CL].Value = record.cl;
            }

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

                this.save.Enabled = false;
                this.toolStripButtonReview.Enabled = false;
                this.dataGridViewDataListChange.ReadOnly = true;

                this.panelSummary.Visible = false;

                this.textBoxSummary.Visible = false;

                this.panelBusinessPeople.Visible = false;
            }
            else
            {
                this.labelReviewBillStaff.Visible = false;
                this.labelReviewDate.Visible = false;
            }
        }
        private void dataGridViewInit()
        {
            // 变更前单据初始化
            m_dateGridVeiwListDataList.addDataGridViewColumn("行号", 40, true, true);
            m_dateGridVeiwListDataList.addDataGridViewColumn("物料ID\\编码(*)", 70, true, false);

            if (m_tablesType == 1)
            {
                m_dateGridVeiwListDataList.addDataGridViewColumn("序号(*)", 40, true, false);
                m_dateGridVeiwListDataList.addDataGridViewColumn("序列号(*)", 50, true, false);
                m_dateGridVeiwListDataList.addDataGridViewColumn("所属部件(*)", 95, true, true);
            }
            else
            {
                m_dateGridVeiwListDataList.addDataGridViewColumn("序号(*)", 40, true, false);
                m_dateGridVeiwListDataList.addDataGridViewColumn("序列号(*)", 50, false, false);
                m_dateGridVeiwListDataList.addDataGridViewColumn("所属部件(*)", 145, true, true);
            }

            m_dateGridVeiwListDataList.addDataGridViewColumn("品牌", 40, true, true);
            m_dateGridVeiwListDataList.addDataGridViewColumn("物料名称(*)", 85, true, true);
            m_dateGridVeiwListDataList.addDataGridViewColumn(" 规格\n 型号", 50, true, true);
            m_dateGridVeiwListDataList.addDataGridViewColumn("尺寸", 40, true, true);
            m_dateGridVeiwListDataList.addDataGridViewColumn("材料", 40, true, true);
            m_dateGridVeiwListDataList.addDataGridViewColumn("参数", 40, true, true);
            m_dateGridVeiwListDataList.addDataGridViewColumn(" 基本\n 单位", 50, true, true);

            m_dateGridVeiwListDataList.addDataGridViewColumn("数量(*)", 50, true, true);
            m_dateGridVeiwListDataList.addDataGridViewColumn("制作方式", 70, true, true);
            m_dateGridVeiwListDataList.addDataGridViewColumn("使用日期(*)", 70, true, true);
            m_dateGridVeiwListDataList.addDataGridViewColumn("备注", 50, true, true);

            m_dateGridVeiwListDataList.initDataGridViewColumn(this.dataGridViewDataListChangeOfter);
            m_dateGridVeiwListDataList.initDataGridViewData(DateGridVeiwListDataListRowCount);


            // 变更后单据初始化
            m_dateGridVeiwListDataListChange.addDataGridViewColumn("行号", 40, true, true);
            m_dateGridVeiwListDataListChange.addDataGridViewColumn("物料ID\\编码(*)", 70, true, false);

            if (m_tablesType == 1)
            {
                m_dateGridVeiwListDataListChange.addDataGridViewColumn("序号(*)", 40, true, false);
                m_dateGridVeiwListDataListChange.addDataGridViewColumn("序列号(*)", 50, true, false);
                m_dateGridVeiwListDataListChange.addDataGridViewColumn("所属部件(*)", 95, true, false);
            }
            else
            {
                m_dateGridVeiwListDataListChange.addDataGridViewColumn("序号(*)", 40, true, false);
                m_dateGridVeiwListDataListChange.addDataGridViewColumn("序列号(*)", 50, false, false);
                m_dateGridVeiwListDataListChange.addDataGridViewColumn("所属部件(*)", 145, true, false);
            }

            m_dateGridVeiwListDataListChange.addDataGridViewColumn("品牌", 40, true, true);
            m_dateGridVeiwListDataListChange.addDataGridViewColumn("物料名称(*)", 85, true, true);
            m_dateGridVeiwListDataListChange.addDataGridViewColumn(" 规格\n 型号", 50, true, true);
            m_dateGridVeiwListDataListChange.addDataGridViewColumn("尺寸", 40, true, false);
            m_dateGridVeiwListDataListChange.addDataGridViewColumn("材料", 40, true, false);
            m_dateGridVeiwListDataListChange.addDataGridViewColumn("参数", 40, true, true);
            m_dateGridVeiwListDataListChange.addDataGridViewColumn(" 基本\n 单位", 50, true, true);

            m_dateGridVeiwListDataListChange.addDataGridViewColumn("数量(*)", 50, true, false);
            m_dateGridVeiwListDataListChange.addDataGridViewColumn("制作方式", 70, true, false);
            m_dateGridVeiwListDataListChange.addDataGridViewColumn("使用日期(*)", 70, true, false);
            m_dateGridVeiwListDataListChange.addDataGridViewColumn("变更原因", 100, true, false);

            m_dateGridVeiwListDataListChange.initDataGridViewColumn(this.dataGridViewDataListChange);
            m_dateGridVeiwListDataListChange.initDataGridViewData(DateGridVeiwListDataListRowCount);

            // 根据单据编号,得到详细数据
            m_purchaseOrderDetails = ProjectManagerDetails.getInctance().getPurchaseInfoFromBillNumber(this.labelSrcOrderBillNum.Text);
        }
        private void readBillInfoToUI()
        {
            this.labelDeviceMode.Visible    = true;
            this.labelTradingDate.Visible   = true;
            this.labelBillNumber.Visible    = true;
            this.labelContractNum.Visible   = true;
            this.labelMakeNum.Visible       = true;
            this.labelDeviceName.Visible    = true;
            this.labelSummary.Visible       = true;
            this.labelMakeBillStaff.Visible = true;
            this.labelMakeDate.Visible      = true;

            this.labelBusinessPeople.Visible  = true;
            this.labelReviewBillStaff.Visible = true;
            this.labelReviewDate.Visible      = true;

            // 单据表头表尾信息
            m_ProjectInfo = FormProject.getInctance().getProjectInfoFromBillNumber(m_billNumber);

            this.labelDeviceMode.Text      = m_ProjectInfo.deviceMode;
            this.labelTradingDate.Text     = m_ProjectInfo.subName;
            this.labelBillNumber.Text      = m_ProjectInfo.billNumber;
            this.labelContractNum.Text     = m_ProjectInfo.projectNum;
            this.labelMakeNum.Text         = m_ProjectInfo.makeNum;
            this.labelDeviceName.Text      = m_ProjectInfo.projectName;
            this.labelSummary.Text         = m_ProjectInfo.note;
            this.labelMakeBillStaff.Text   = m_ProjectInfo.makeOrderStaffName;
            this.labelMakeDate.Text        = m_ProjectInfo.makeOrderDate;
            this.labelBusinessPeople.Text  = m_ProjectInfo.designStaffName;
            this.labelReviewBillStaff.Text = m_ProjectInfo.orderrReviewName;
            this.labelReviewDate.Text      = m_ProjectInfo.reviewDate;


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

            foreach (KeyValuePair <int, ProjectManagerDetailsTable> index in purchaseOrderDetails)
            {
                ProjectManagerDetailsTable record = new ProjectManagerDetailsTable();
                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.Brand].Value          = record.materielBrand;
                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.Parameter].Value = record.materielParameter;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Size].Value      = record.materielSize;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Unit].Value      = record.materielUnit;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Value].Value     = record.value;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.MakeType].Value  = record.makeType;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Note].Value      = record.materielNote;


                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Num].Value        = record.no;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Sequence].Value   = record.sequence;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.UseDate].Value    = record.useDate;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.DeviceName].Value = record.deviceName;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.CL].Value         = record.cl;
            }

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

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

                this.panelSummary.Visible = false;

                this.dateTimePickerTradingDate.Visible = false;

                this.textBoxSummary.Visible = false;

                this.panelBusinessPeople.Visible = false;

                // 变更按钮处于可用状态
                this.toolStripButtonChange.Enabled = true;
            }
            else if (m_ProjectInfo.isReview == "2")
            {
                //this.labelReviewBillStaff.Text = m_ProjectInfo.orderrReviewName;
                //this.labelReviewDate.Text = m_ProjectInfo.reviewDate;
                //this.panelIsReview.Visible = true;

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

                //this.panelSummary.Visible = false;

                //this.dateTimePickerTradingDate.Visible = false;

                //this.textBoxSummary.Visible = false;

                //this.panelBusinessPeople.Visible = false;

                //// 变更按钮处于可用状态
                //this.panelIsReview.Visible = false;
                //this.toolStripButtonChange.Enabled = false;
                //this.toolStripButtonChangeReview.Enabled = true;
            }
            else
            {
                this.labelReviewBillStaff.Visible = false;
                this.labelReviewDate.Visible      = false;
            }

            //if (m_ProjectInfo.changeStaffName.Length > 0 || m_ProjectInfo.changeReviewStaffName.Length > 0)
            //{
            //    this.panelChange.Visible = true;
            //}
        }