static public MaterielInEarningsOrderDetails getInctance()
        {
            if (m_instance == null)
            {
                m_instance = new MaterielInEarningsOrderDetails();
            }

            return(m_instance);
        }
        private void updateMaterielData(string billNumber)
        {
            SortedDictionary <int, MaterielInEarningsOrderDetailsTable> dataList =
                MaterielInEarningsOrderDetails.getInctance().getMaterielInEarningsInfoFromBillNumber(billNumber);

            foreach (KeyValuePair <int, MaterielInEarningsOrderDetailsTable> index in dataList)
            {
                MaterielInEarningsOrderDetailsTable record = index.Value;

                //InitMaterielTable materielRecord = new InitMaterielTable();
                //materielRecord.materielID = record.materielID;
                //materielRecord.value = (int)record.value;
                //materielRecord.price = record.price;

                //if (m_isRedBill)
                //{
                //    InitMateriel.getInctance().materielOutStorage(materielRecord, false);
                //}
                //else
                //{
                //    InitMateriel.getInctance().insert(materielRecord, false);
                //}
                #region 更新库存汇总表(INIT_STORAGE_STOCK)
                InitMaterielTable materielRecord = new InitMaterielTable();
                materielRecord.materielID = record.materielID;
                materielRecord.value      = record.value;
                materielRecord.price      = record.price;

                if (m_isRedBill)
                {
                    InitMateriel.getInctance().materielOutStorage(materielRecord, false);
                }
                else
                {
                    InitMateriel.getInctance().insert(materielRecord, false);
                }
                #endregion

                #region 更新存货明细账表(STORAGE_STOCK_DETAIL) 2012-1-16 01:22
                StorageStockDetailTable storageStockDetailRecord = new StorageStockDetailTable();
                storageStockDetailRecord.materielID  = record.materielID;
                storageStockDetailRecord.tradingDate = DateTime.Now.ToString("yyyyMMdd");
                storageStockDetailRecord.billNumber  = billNumber;
                storageStockDetailRecord.thingsType  = "盘盈入库";
                storageStockDetailRecord.isIn        = 1;

                // 本次交易数量和单价
                if (m_isRedBill)
                {
                    storageStockDetailRecord.value = record.value * -1;
                }
                else
                {
                    storageStockDetailRecord.value = record.value;
                }
                storageStockDetailRecord.price = record.price;

                // 交易完毕后数量和单价
                InitMaterielTable materielStorageData = InitMateriel.getInctance().getMaterielInfoFromMaterielID(record.materielID);
                storageStockDetailRecord.storageValue = materielStorageData.value;
                storageStockDetailRecord.storagePrice = materielStorageData.price;

                StorageStockDetail.getInctance().insert(storageStockDetailRecord);
                #endregion
            }
        }