示例#1
0
        public void insert(MaterielOutOtherOrderTable record, bool isDisplayMessageBox = true)
        {
            MaterielOutOtherOrderTable oldRecord = new MaterielOutOtherOrderTable();

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

            insert += "[PROJECT_NO],[MAKE_NO],[EXCHANGES_UNIT],[SUM_VALUE],[SUM_MONEY],[MAKE_ORDER_STAFF],[STAFF_SAVE_ID],[MATERIEL_STAFF],[IS_RED_BILL]) VALUES(";

            // 根据单据编号,判断库中是否已经存在该单据 如果存在单据首先删除单据,然后再执行插入操作
            if (checkBillIsExist(record.billNumber))
            {
                delete(record.billNumber);
            }

            insert += "'" + record.tradingDate + "',";
            insert += "'" + record.billNumber + "',";

            insert += "'" + record.projectNo + "',";
            insert += "'" + record.makeNo + "',";

            insert += "'" + record.exchangesUnit + "',";
            insert += "'" + record.sumValue + "',";
            insert += "'" + record.sumMoney + "',";
            insert += record.makeOrderStaff + ",";
            insert += record.staffSaveId + ",";
            insert += record.materielOutStaffId + ",";

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

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

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

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

            writeOperatorLog(306, OperatorLogType.Add, record.billNumber);
        }
示例#2
0
        private void load()
        {
            string sql = "SELECT [PKEY],[TRADING_DATE],[BILL_NUMBER],[PROJECT_NO],[MAKE_NO],[EXCHANGES_UNIT],[SUM_VALUE],[SUM_MONEY],";

            sql += "[MAKE_ORDER_STAFF],[MATERIEL_STAFF],[ORDERR_REVIEW],[REVIEW_DATE],[IS_REVIEW],[STAFF_SAVE_ID],[IS_RED_BILL] ";
            sql += "FROM [dbo].[WAREHOUSE_MANAGEMENT_OUT_OTHER] ORDER BY PKEY";

            m_tableDataList.Clear();

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

                    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.exchangesUnit = DbDataConvert.ToString(row["EXCHANGES_UNIT"]);

                    record.projectNo = DbDataConvert.ToString(row["PROJECT_NO"]);
                    record.makeNo    = DbDataConvert.ToString(row["MAKE_NO"]);

                    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.materielOutStaffId   = DbDataConvert.ToInt32(row["MATERIEL_STAFF"]);
                    record.materielOutStaffName = Staff.getInctance().getStaffNameFromPkey(record.materielOutStaffId);

                    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"]);

                    m_tableDataList.Add(m_tableDataList.Count, record);
                }
            }
        }
示例#3
0
        public MaterielOutOtherOrderTable getMaterielOutOtherOrderInfoFromBillNumber(string billNumber)
        {
            MaterielOutOtherOrderTable record = new MaterielOutOtherOrderTable();

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

            return(record);
        }
示例#4
0
        public bool checkBillIsExist(string billNumber)
        {
            bool isRet = false;

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

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

            return(isRet);
        }
示例#5
0
        public SortedDictionary <int, MaterielOutOtherOrderTable> getAllNotReviewMaterielOutOtherOrderInfo()
        {
            SortedDictionary <int, MaterielOutOtherOrderTable> list = new SortedDictionary <int, MaterielOutOtherOrderTable>();

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

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

            return(list);
        }