Example #1
0
        static public MaterielInOrderDetails getInctance()
        {
            if (m_instance == null)
            {
                m_instance = new MaterielInOrderDetails();
            }

            return(m_instance);
        }
Example #2
0
        private void updateMaterielData(string billNumber)
        {
            SortedDictionary <int, MaterielInOrderDetailsTable> dataList =
                MaterielInOrderDetails.getInctance().getMaterielInInfoFromBillNumber(billNumber);

            foreach (KeyValuePair <int, MaterielInOrderDetailsTable> index in dataList)
            {
                MaterielInOrderDetailsTable 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
            }
        }