Ejemplo n.º 1
0
        private void load()
        {
            string sql = "SELECT [PKEY],[TRADING_DATE],[BILL_NUMBER],[SUM_VALUE],[SUM_MONEY],[MAKE_ORDER_STAFF],[STAFF_CHECK_ID],";

            sql += "[ORDERR_REVIEW],[REVIEW_DATE],[IS_REVIEW],[STAFF_SAVE_ID],[IS_RED_BILL],[IS_IN_LEDGER],[ORDERR_IN_LEDGER],[IN_LEDGER_DATE] ";
            sql += "FROM [dbo].[WAREHOUSE_MANAGEMENT_IN_EARNINGS] ORDER BY PKEY";

            m_tableDataList.Clear();

            using (DataTable dataTable = DatabaseAccessFactoryInstance.Instance.QueryDataTable(FormMain.DB_NAME, sql))
            {
                foreach (DataRow row in dataTable.Rows)
                {
                    MaterielInEarningsOrderTable record = new MaterielInEarningsOrderTable();

                    record.pkey        = DbDataConvert.ToInt32(row["PKEY"]);
                    record.tradingDate = DbDataConvert.ToDateTime(row["TRADING_DATE"]).ToString("yyyy-MM-dd");
                    record.billNumber  = DbDataConvert.ToString(row["BILL_NUMBER"]);

                    record.sumValue = DbDataConvert.ToString(row["SUM_VALUE"]);
                    record.sumMoney = DbDataConvert.ToString(row["SUM_MONEY"]);

                    record.staffSaveId   = DbDataConvert.ToInt32(row["STAFF_SAVE_ID"]);
                    record.staffSaveName = Staff.getInctance().getStaffNameFromPkey(record.staffSaveId);

                    record.orderReviewStaffId   = DbDataConvert.ToInt32(row["STAFF_CHECK_ID"]);
                    record.orderReviewStaffName = Staff.getInctance().getStaffNameFromPkey(record.orderReviewStaffId);

                    record.makeOrderStaff     = DbDataConvert.ToInt32(row["MAKE_ORDER_STAFF"]);
                    record.makeOrderStaffName = Staff.getInctance().getStaffNameFromPkey(record.makeOrderStaff);

                    record.isReview = DbDataConvert.ToString(row["IS_REVIEW"]);
                    if (DbDataConvert.ToString(row["ORDERR_REVIEW"]).Length > 0)
                    {
                        record.orderrReview     = DbDataConvert.ToInt32(row["ORDERR_REVIEW"]);
                        record.orderrReviewName = Staff.getInctance().getStaffNameFromPkey(record.orderrReview);
                        record.reviewDate       = DbDataConvert.ToDateTime(row["REVIEW_DATE"]).ToString("yyyy-MM-dd");
                    }

                    record.isRedBill = DbDataConvert.ToInt32(row["IS_RED_BILL"]);

                    // 记账相关信息
                    if (DbDataConvert.ToString(row["ORDERR_IN_LEDGER"]).Length > 0)
                    {
                        record.orderInLedger     = DbDataConvert.ToInt32(row["ORDERR_IN_LEDGER"]);
                        record.orderInLedgerName = Staff.getInctance().getStaffNameFromPkey(record.orderrReview);
                        record.inLedgerDate      = DbDataConvert.ToDateTime(row["IN_LEDGER_DATE"]).ToString("yyyy-MM-dd");
                        record.isInLedger        = DbDataConvert.ToInt32(row["IS_IN_LEDGER"]);
                    }

                    m_tableDataList.Add(m_tableDataList.Count, record);
                }
            }
        }
Ejemplo n.º 2
0
        public MaterielInEarningsOrderTable getMaterielInEarningsOrderInfoFromBillNumber(string billNumber)
        {
            MaterielInEarningsOrderTable record = new MaterielInEarningsOrderTable();

            foreach (KeyValuePair <int, MaterielInEarningsOrderTable> index in m_tableDataList)
            {
                if (index.Value.billNumber == billNumber)
                {
                    record = index.Value;
                    break;
                }
            }

            return(record);
        }
Ejemplo n.º 3
0
        public bool checkBillIsExist(string billNumber)
        {
            bool isRet = false;

            foreach (KeyValuePair <int, MaterielInEarningsOrderTable> index in m_tableDataList)
            {
                MaterielInEarningsOrderTable record = new MaterielInEarningsOrderTable();

                if (index.Value.billNumber == billNumber)
                {
                    isRet = true;
                    break;
                }
            }

            return(isRet);
        }
Ejemplo n.º 4
0
        public SortedDictionary <int, MaterielInEarningsOrderTable> getAllNotReviewMaterielInEarningsOrderInfo()
        {
            SortedDictionary <int, MaterielInEarningsOrderTable> list = new SortedDictionary <int, MaterielInEarningsOrderTable>();

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

                if (index.Value.isReview != "1")
                {
                    list.Add(list.Count, index.Value);
                }
            }

            return(list);
        }
Ejemplo n.º 5
0
        public void insert(MaterielInEarningsOrderTable record, bool isDisplayMessageBox = true)
        {
            bool isExistReview = false;
            MaterielInEarningsOrderTable oldRecord = new MaterielInEarningsOrderTable();

            string insert = "INSERT INTO [dbo].[WAREHOUSE_MANAGEMENT_IN_EARNINGS]([TRADING_DATE],[BILL_NUMBER],";

            insert += "[SUM_VALUE],[SUM_MONEY],[MAKE_ORDER_STAFF],[STAFF_SAVE_ID],[STAFF_CHECK_ID],";
            insert += "[IS_RED_BILL],[IS_IN_LEDGER]";

            // 根据单据编号,判断库中是否已经存在该单据 如果存在单据首先删除单据,然后再执行插入操作
            if (checkBillIsExist(record.billNumber))
            {
                if (checkBillIsReview(record.billNumber))
                {
                    isExistReview = true;
                    insert       += ",[ORDERR_REVIEW], [REVIEW_DATE], [IS_REVIEW] ";
                    oldRecord     = getMaterielInEarningsOrderInfoFromBillNumber(record.billNumber);
                }

                delete(record.billNumber);
            }

            insert += ") VALUES(";

            insert += "'" + record.tradingDate + "',";
            insert += "'" + record.billNumber + "',";
            insert += "'" + record.sumValue + "',";
            insert += "'" + record.sumMoney + "',";
            insert += record.makeOrderStaff + ",";
            insert += record.staffSaveId + ",";
            insert += record.orderReviewStaffId + ",";

            // 红字蓝字标示
            insert += record.isRedBill + ",0";

            // 如果单据已经审核过,把之前的审核信息写到该记录中
            if (isExistReview)
            {
                insert += ",";
                insert += oldRecord.orderrReview + ",";
                insert += "'" + oldRecord.reviewDate + "', 1";
            }

            insert += ")";

            try
            {
                DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, insert);

                if (isDisplayMessageBox)
                {
                    MessageBoxExtend.messageOK("数据保存成功");
                }

                load();
            }
            catch (Exception error)
            {
                MessageBoxExtend.messageWarning(error.Message);
                return;
            }

            writeOperatorLog(302, OperatorLogType.Add, record.billNumber);
        }