Example #1
0
        /// <summary>
        /// Delete an destination
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int DeleteDest(int id)
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            //Open SQL connection
            SQL.Open();
            //SQL query string
            query = "DELETE FROM pts_destination WHERE destination_id ='" + id + "'";
            //Execute non query for read database
            int result = SQL.Command(query).ExecuteNonQuery();

            query = string.Empty;
            SQL.Close();
            return(result);
        }
Example #2
0
        /// <summary>
        /// Delete an item
        /// </summary>
        /// <param name="inItem">Input item</param>
        /// <returns>Number item is deleted</returns>
        public int DeleteItem(pts_stockout_log inItem)
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            //Open SQL connection
            SQL.Open();
            //SQL query string
            query = "DELETE FROM pts_stockout_log WHERE stockout_id ='" + inItem.stockout_id + "'";
            //Execute non query for read database
            int result = SQL.Command(query).ExecuteNonQuery();

            query = string.Empty;
            SQL.Close();
            return(result);
        }
Example #3
0
        public int AddDepartment(m_department adddept)
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            //Open SQL connection
            SQL.Open();
            //SQL query string
            query  = "INSERT INTO m_department(dept_cd, dept_name, registration_user_cd)";
            query += "VALUES ('" + adddept.dept_cd + "','" + adddept.dept_name + "','" + adddept.registration_user_cd + "')";
            //Execute non query for read database
            int result = SQL.Command(query).ExecuteNonQuery();

            query = string.Empty;
            return(result);
        }
Example #4
0
        /// <summary>
        /// Get a supplier
        /// </summary>
        /// <param name="inItem">input info supplier to search</param>
        /// <returns></returns>
        public pts_supplier GetSupplier(pts_supplier inItem)
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            //Open SQL connection
            SQL.Open();
            //SQL query string
            query  = "select supplier_id, supplier_cd, supplier_name, supplier_tel, supplier_fax, supplier_address, registration_date_time,registration_user_cd ";
            query += "from pts_supplier where 1=1 ";
            if (inItem.supplier_id > 0)
            {
                query += "and supplier_id ='" + inItem.supplier_id + "' ";
            }
            if (!string.IsNullOrEmpty(inItem.supplier_cd))
            {
                query += "and supplier_cd ='" + inItem.supplier_cd + "' ";
            }
            if (!string.IsNullOrEmpty(inItem.supplier_name))
            {
                query += "and supplier_name ='" + inItem.supplier_name + "' ";
            }
            //Execute reader for read database
            IDataReader reader = SQL.Command(query).ExecuteReader();

            reader.Read();
            pts_supplier outItem = new pts_supplier
            {
                supplier_id            = (int)reader["supplier_id"],
                supplier_cd            = reader["supplier_cd"].ToString(),
                supplier_name          = reader["supplier_name"].ToString(),
                supplier_tel           = reader["supplier_tel"].ToString(),
                supplier_fax           = reader["supplier_fax"].ToString(),
                supplier_address       = reader["supplier_address"].ToString(),
                registration_date_time = (DateTime)reader["registration_date_time"],
                registration_user_cd   = reader["registration_user_cd"].ToString()
            };

            reader.Close();
            query = string.Empty;
            //Close SQL connection
            SQL.Close();
            return(outItem);
        }
Example #5
0
        public int AddIssueCode(pts_issue_code addptsissuecd)
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            //Open SQL connection
            SQL.Open();
            //SQL query string
            query  = "INSERT INTO pts_issue_code(issue_cd, issue_name, registration_user_cd)";
            query += "VALUES ('" + addptsissuecd.issue_cd + "','" + addptsissuecd.issue_name + "','";
            query += addptsissuecd.registration_user_cd + "')";
            //Execute non query for read database
            int result = SQL.Command(query).ExecuteNonQuery();

            query = string.Empty;
            return(result);
        }
Example #6
0
        /// <summary>
        /// Update an item type
        /// </summary>
        /// <param name="inItem">input item type</param>
        /// <returns></returns>
        public int Update(pts_item_type inItem)
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            //Open SQL connection
            SQL.Open();
            //SQL query string
            query  = "UPDATE pts_item_type SET type_id='" + inItem.type_id + "', type_name='" + inItem.type_name;
            query += "', registration_user_cd ='" + inItem.registration_user_cd;
            query += "', registration_date_time = now() where type_id ='" + inItem.type_id + "'";
            //Execute non query for read database
            int result = SQL.Command(query).ExecuteNonQuery();

            query = string.Empty;
            return(result);
        }
Example #7
0
        /// <summary>
        /// Delete an user postition
        /// </summary>
        /// <param name="inItem">input user position</param>
        /// <returns></returns>
        public int Delete(m_user_position inItem)
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            //Open SQL connection
            SQL.Open();
            //SQL query string
            query = "DELETE FROM m_user_position WHERE user_position_id ='" + inItem.user_position_id + "'";
            //Execute non query for add item
            int result = SQL.Command(query).ExecuteNonQuery();

            query = string.Empty;
            //Close SQL connection
            SQL.Close();
            return(result);
        }
Example #8
0
        public int UpdateDest(pts_destination updest)
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            //Open SQL connection
            SQL.Open();
            //SQL query string
            query  = "UPDATE pts_destination SET destination_cd='" + updest.destination_cd + "',destination_name = '" + updest.destination_name + "',dept_cd = '" + updest.dept_cd;
            query += "', registration_user_cd ='" + updest.registration_user_cd;
            query += "', registration_date_time = now() where destination_id ='" + updest.destination_id + "'";
            //Execute non query for read database
            int result = SQL.Command(query).ExecuteNonQuery();

            query = string.Empty;
            return(result);
        }
Example #9
0
        /// <summary>
        /// Update stock qty value
        /// </summary>
        /// <returns></returns>
        public int UpdateStockValue()
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            //Open SQL connection
            SQL.Open();
            //SQL query string
            query  = "update pts_item a set wh_qty = (select sum(c.packing_qty) from pts_stock c where a.item_cd = c.item_cd)";
            query += "from pts_stock b where a.item_cd = b.item_cd";
            //Execute non query for read database
            int result = SQL.Command(query).ExecuteNonQuery();

            query = string.Empty;
            SQL.Close();
            return(result);
        }
Example #10
0
        /// <summary>
        /// Update issue code
        /// </summary>
        /// <param name="UpdateIssueCd"></param>
        /// <returns></returns>
        public int UpdateIssueCode(pts_issue_code UpdateIssueCd)
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            //Open SQL connection
            SQL.Open();
            //SQL query string
            query  = "UPDATE pts_issue_code SET issue_cd='" + UpdateIssueCd.issue_cd + "', issue_name='" + UpdateIssueCd.issue_name + "',registration_user_cd ='" + UpdateIssueCd.registration_user_cd;
            query += "', registration_date_time = now() where issue_cd ='" + UpdateIssueCd.issue_cd + "'";
            //Execute non query for read database
            int result = SQL.Command(query).ExecuteNonQuery();

            query = string.Empty;
            SQL.Close();
            return(result);
        }
Example #11
0
        /// <summary>
        /// Delete ON THIS REQUEST
        /// </summary>
        /// <returns></returns>
        public int Delete()
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            //Open SQL connection
            SQL.Open();
            //SQL query string
            query = "DELETE FROM pts_request_log WHERE request_id ='" + request_id + "'";
            //Execute non query for insert database
            int result = SQL.Command(query).ExecuteNonQuery();

            query = string.Empty;
            //Close SQL connection
            SQL.Close();
            return(result);
        }
Example #12
0
        /// <summary>
        /// Add an item type
        /// </summary>
        /// <param name="inItem">new item type</param>
        /// <returns></returns>
        public int AddItemType(pts_item_type inItem)
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            //Open SQL connection
            SQL.Open();
            //SQL query string
            query  = "INSERT INTO pts_item_type(type_id, type_name, registration_user_cd)";
            query += "VALUES ('" + inItem.type_id + "','" + inItem.type_name + "','" + inItem.registration_user_cd + "')";
            //Execute non query for read database
            int result = SQL.Command(query).ExecuteNonQuery();

            query = string.Empty;
            SQL.Close();
            return(result);
        }
Example #13
0
        /// <summary>
        /// Get list user with department and position
        /// </summary>
        /// <param name="dept_code"></param>
        /// <param name="postion_code"></param>
        public void GetListUser(string dept_code, string postion_code)
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            //Open SQL connection
            SQL.Open();
            //SQL query string
            query = @"SELECT user_cd, user_name, locale_id, multi_login_flag, registration_user_cd, registration_date_time,
                      registrated_factory_cd, dept_cd, user_position_cd FROM m_mes_user WHERE 1=1 ";
            if (!string.IsNullOrEmpty(dept_code))
            {
                query += "and dept_cd ='" + dept_code + "' ";
            }
            if (!string.IsNullOrEmpty(postion_code))
            {
                query += "and user_position_cd ='" + postion_code + "' ";
            }
            query += "ORDER BY user_cd";
            //Execute reader for read database
            IDataReader reader = SQL.Command(query).ExecuteReader();

            query = string.Empty;
            while (reader.Read())
            {
                //Get an item
                m_mes_user outItem = new m_mes_user
                {
                    user_cd                = reader["user_cd"].ToString(),
                    user_name              = reader["user_name"].ToString(),
                    locale_id              = (int)reader["locale_id"],
                    multi_login_flag       = reader["multi_login_flag"].ToString(),
                    registration_date_time = (DateTime)reader["registration_date_time"],
                    registration_user_cd   = reader["registration_user_cd"].ToString(),
                    dept_cd                = reader["dept_cd"].ToString(),
                    user_position_cd       = reader["user_position_cd"].ToString(),
                };
                listMesUser.Add(outItem);
            }
            reader.Close();
            //Close SQL connection
            SQL.Close();
        }
Example #14
0
        /// <summary>
        /// Get list destination from database with destination code and department code
        /// </summary>
        /// <param name="des_code">string.empty if get list without destination code</param>
        /// <param name="dept_code">string.empty if get list without department code</param>
        public void GetListDestination(string des_code, string dept_code)
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            listdestination = new BindingList <pts_destination>();
            //Open SQL connection
            SQL.Open();
            //SQL query string
            query  = "SELECT destination_id, destination_cd, destination_name, dept_cd, registration_user_cd, registration_date_time ";
            query += "FROM pts_destination WHERE 1=1 ";
            if (!string.IsNullOrEmpty(des_code))
            {
                query += "and destination_cd = '" + des_code + "' ";
            }
            if (!string.IsNullOrEmpty(dept_code))
            {
                query += "and dept_cd = '" + dept_code + "' ";
            }
            query += "order by destination_id";
            //Execute reader for read database
            IDataReader reader = SQL.Command(query).ExecuteReader();

            query = string.Empty;
            while (reader.Read())
            {
                //Get an item
                pts_destination outItem = new pts_destination
                {
                    destination_id         = (int)reader["destination_id"],
                    destination_cd         = reader["destination_cd"].ToString(),
                    destination_name       = reader["destination_name"].ToString(),
                    dept_cd                = reader["dept_cd"].ToString(),
                    registration_date_time = (DateTime)reader["registration_date_time"],
                    registration_user_cd   = reader["registration_user_cd"].ToString()
                };
                //Add item into list
                listdestination.Add(outItem);
            }
            reader.Close();
            //Close SQL connection
            SQL.Close();
        }
Example #15
0
 /// <summary>
 /// Get infomation of an item with item code
 /// </summary>
 /// <param name="itemCD">item code</param>
 /// <returns></returns>
 public pts_item GetItem(string itemCD)
 {
     try
     {
         //SQL library
         PSQL   SQL   = new PSQL();
         string query = string.Empty;
         //Open SQL connection
         SQL.Open();
         //SQL query string
         query  = "SELECT item_cd, item_name, type_id, item_lv, item_location, item_unit, lot_size, wh_qty, wip_qty, ";
         query += "repair_qty, registration_user_cd, registration_date_time FROM pts_item WHERE 1=1 ";
         query += "and item_cd = '" + itemCD + "' ";
         query += "order by item_cd";
         //Execute reader for read database
         IDataReader reader = SQL.Command(query).ExecuteReader();
         query = string.Empty;
         reader.Read();
         //Get an item
         pts_item outItem = new pts_item
         {
             item_cd                = reader["item_cd"].ToString(),
             item_name              = reader["item_name"].ToString(),
             type_id                = (int)reader["type_id"],
             item_lv                = (int)reader["item_lv"],
             item_location          = reader["item_location"].ToString(),
             item_unit              = reader["item_unit"].ToString(),
             lot_size               = (double)reader["lot_size"],
             wh_qty                 = (double)reader["wh_qty"],
             wip_qty                = (double)reader["wip_qty"],
             repair_qty             = (double)reader["repair_qty"],
             registration_date_time = (DateTime)reader["registration_date_time"],
             registration_user_cd   = reader["registration_user_cd"].ToString()
         };
         reader.Close();
         //Close SQL connection
         SQL.Close();
         return(outItem);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Example #16
0
        /// <summary>
        /// Search list premac item from DB
        /// </summary>
        /// <param name="inItem">search info</param>
        public void Search(pre_649_order inItem)
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            listOrderItem = new List <pre_649_order>();
            //Open SQL connection
            SQL.Open();
            //SQL query string
            query  = "SELECT item_number, order_number, order_qty, supplier_cd, order_date ";
            query += "FROM pre_649_order WHERE 1=1 ";
            if (!string.IsNullOrEmpty(inItem.item_number))
            {
                query += "AND item_number ='" + inItem.item_number + "' ";
            }
            if (!string.IsNullOrEmpty(inItem.order_number))
            {
                query += "AND order_number ='" + inItem.order_number + "' ";
            }
            query += "ORDER BY item_number, order_date";
            //Execute reader for read database
            IDataReader reader = SQL.Command(query).ExecuteReader();

            query = string.Empty;
            while (reader.Read())
            {
                //Get an item
                pre_649_order outItem = new pre_649_order
                {
                    item_number  = reader["item_number"].ToString(),
                    order_number = reader["order_number"].ToString(),
                    order_qty    = (double)reader["order_qty"],
                    supplier_cd  = reader["supplier_cd"].ToString(),
                    order_date   = (DateTime)reader["order_date"],
                };
                //Add item into list
                listOrderItem.Add(outItem);
            }
            reader.Close();
            //Close SQL connection
            SQL.Close();
        }
Example #17
0
        /// <summary>
        /// Add new log
        /// </summary>
        /// <param name="inItem">add new log_action, usercode, stockid, stockfield, before_value, after_value</param>
        /// <returns></returns>
        public int AddLog(pts_stock_log inItem)
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            //Open SQL connection
            SQL.Open();
            //SQL query string
            query  = "INSERT INTO pts_stock_log(log_action, log_user_cd, stock_id, stock_field, before_value, after_value) ";
            query += "VALUES('" + inItem.log_action + "','" + inItem.log_user_cd + "','" + inItem.stock_id + "','" + inItem.stock_field;
            query += "','" + inItem.before_value + "','" + inItem.after_value + "')";
            //Execute non query for read database
            int result = SQL.Command(query).ExecuteNonQuery();

            query = string.Empty;
            SQL.Close();
            return(result);
        }
Example #18
0
        public int AddItem(pts_noplan inItem)
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            //Open SQL connection
            SQL.Open();
            //SQL query string
            query  = "INSERT INTO pts_noplan(noplan_cd, destination_cd, item_cd, noplan_qty, noplan_usercd, noplan_date) VALUES ";
            query += "('" + inItem.noplan_cd + "','" + inItem.destination_cd + "','" + inItem.item_cd + "','";
            query += inItem.noplan_qty + "','" + inItem.noplan_usercd + "','" + inItem.noplan_date + "')";
            //Execute non query SQL
            int result = SQL.Command(query).ExecuteNonQuery();

            query = string.Empty;
            SQL.Close();
            return(result);
        }
Example #19
0
        /// <summary>
        /// Update when PC manager approved
        /// </summary>
        /// <param name="inItem">only use pc_m_confirm and comment</param>
        /// <returns></returns>
        public int PC_MConfirm(pts_request_log inItem)
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            //Open SQL connection
            SQL.Open();
            //SQL query string
            query  = "UPDATE pts_request_log SET pc_m_confirm ='" + inItem.pc_m_cofirm + "', comment ='" + inItem.comment;
            query += "' WHERE request_id ='" + inItem.request_id + "'";
            //Execute non query for insert database
            int result = SQL.Command(query).ExecuteNonQuery();

            query = string.Empty;
            //Close SQL connection
            SQL.Close();
            return(result);
        }
Example #20
0
        /// <summary>
        /// Add supplier item
        /// </summary>
        /// <param name="addptssupplier"></param>
        /// <returns></returns>
        public int AddSupplier(pts_supplier addptssupplier)
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            //Open SQL connection
            SQL.Open();
            //SQL query string
            query  = "INSERT INTO pts_supplier(supplier_cd, supplier_name, supplier_tel, supplier_fax, supplier_address, registration_user_cd)";
            query += "VALUES ('" + addptssupplier.supplier_cd + "','" + addptssupplier.supplier_name + "','";
            query += addptssupplier.supplier_tel + "','" + addptssupplier.supplier_fax + "','" + addptssupplier.supplier_address + "','";
            query += addptssupplier.registration_user_cd + "')";
            //Execute non query for read database
            int result = SQL.Command(query).ExecuteNonQuery();

            query = string.Empty;
            return(result);
        }
Example #21
0
        /// <summary>
        /// Update supplier
        /// </summary>
        /// <param name="UpSupplier"></param>
        /// <returns></returns>
        public int UpdateSuplier(pts_supplier UpSupplier)
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            //Open SQL connection
            SQL.Open();
            //SQL query string
            query  = "UPDATE pts_supplier SET supplier_cd='" + UpSupplier.supplier_cd + "', supplier_name='" + UpSupplier.supplier_name;
            query += "', supplier_tel ='" + UpSupplier.supplier_tel + "', supplier_fax ='" + UpSupplier.supplier_fax;
            query += "', supplier_address ='" + UpSupplier.supplier_address + "',registration_user_cd ='" + UpSupplier.registration_user_cd;
            query += "', registration_date_time = now() where supplier_cd ='" + UpSupplier.supplier_cd + "'";
            //Execute non query for read database
            int result = SQL.Command(query).ExecuteNonQuery();

            query = string.Empty;
            return(result);
        }
Example #22
0
        /// <summary>
        /// Add an item into database
        /// </summary>
        /// <param name="inItem"></param>
        /// <returns></returns>
        public int AddItem(pts_item inItem)
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            //Open SQL connection
            SQL.Open();
            //SQL query string
            query  = "INSERT INTO pts_item(type_id, item_cd, item_name, item_location, item_unit, lot_size, registration_user_cd) ";
            query += "VALUES ('" + inItem.type_id + "','" + inItem.item_cd + "','" + inItem.item_name + "','";
            query += inItem.item_location + "','" + inItem.item_unit + "','" + inItem.lot_size + "','";
            query += inItem.registration_user_cd + "')";
            //Execute non query for read database
            int result = SQL.Command(query).ExecuteNonQuery();

            query = string.Empty;
            return(result);
        }
Example #23
0
        /// <summary>
        /// Get an user infomation
        /// </summary>
        /// <param name="user_code">User code</param>
        /// <returns></returns>
        public m_mes_user GetUser(string user_code)
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            //Open SQL connection
            SQL.Open();
            //SQL query string
            query  = "SELECT user_cd, user_name, locale_id, multi_login_flag, registration_user_cd, registration_date_time, ";
            query += "registrated_factory_cd, dept_cd, user_position_cd FROM m_mes_user WHERE 1=1 ";
            if (user_code.Length >= 6)
            {
                query += "AND user_cd like '%" + user_code + "'";
            }
            else
            {
                query += "AND user_cd ='" + user_code + "'";
            }
            //Execute reader for read database
            IDataReader reader = SQL.Command(query).ExecuteReader();

            query = string.Empty;
            reader.Read();
            //Get an item
            m_mes_user outItem = new m_mes_user
            {
                user_cd                = reader["user_cd"].ToString(),
                user_name              = reader["user_name"].ToString(),
                locale_id              = (int)reader["locale_id"],
                multi_login_flag       = reader["multi_login_flag"].ToString(),
                registration_date_time = (DateTime)reader["registration_date_time"],
                registration_user_cd   = reader["registration_user_cd"].ToString(),
                dept_cd                = reader["dept_cd"].ToString(),
                user_position_cd       = reader["user_position_cd"].ToString(),
            };

            reader.Close();
            //Close SQL connection
            SQL.Close();
            return(outItem);
        }
Example #24
0
        /// <summary>
        /// Get list supplier from database with supplier code
        /// </summary>
        /// <param name="supplier_code">string.empty if get all supplier in database</param>
        public void GetListSupplier(string supplier_code)
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            listSupplier = new List <pts_supplier>();
            //Open SQL connection
            SQL.Open();
            //SQL query string
            query  = "select supplier_id, supplier_cd, supplier_name, supplier_tel, supplier_fax, supplier_address, registration_date_time,registration_user_cd ";
            query += "from pts_supplier where 1=1 ";
            if (!string.IsNullOrEmpty(supplier_code))
            {
                query += "and supplier_cd = '" + supplier_code + "' ";
            }
            query += "order by supplier_cd";
            //Execute reader for read database
            IDataReader reader = SQL.Command(query).ExecuteReader();

            query = string.Empty;
            while (reader.Read())
            {
                //Get an item
                pts_supplier outItem = new pts_supplier
                {
                    supplier_id            = (int)reader["supplier_id"],
                    supplier_cd            = reader["supplier_cd"].ToString(),
                    supplier_name          = reader["supplier_name"].ToString(),
                    supplier_tel           = reader["supplier_tel"].ToString(),
                    supplier_fax           = reader["supplier_fax"].ToString(),
                    supplier_address       = reader["supplier_address"].ToString(),
                    registration_date_time = (DateTime)reader["registration_date_time"],
                    registration_user_cd   = reader["registration_user_cd"].ToString()
                };
                //Add item into list
                listSupplier.Add(outItem);
            }
            reader.Close();
            //Close SQL connection
            SQL.Close();
        }
Example #25
0
        public void SearchMultiPacking(string processCD, string itemCD)
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            listStockOutItem = new List <pts_stockout_log>();
            //Open SQL connection
            SQL.Open();
            //SQL query string
            query  = "SELECT stockout_id, packing_cd, process_cd, issue_cd, stockout_date, stockout_user_cd, stockout_qty, ";
            query += "real_qty, received_user_cd, comment, remark FROM pts_stockout_log WHERE 1=1 ";
            query += "AND process_cd like '" + processCD + "%' and packing_cd in(select packing_cd from pts_stock where item_cd ='" + itemCD + "') ";
            query += "ORDER BY packing_cd";
            //Execute reader for read database
            IDataReader reader = SQL.Command(query).ExecuteReader();

            //Clear query
            query = string.Empty;
            //Read data into list
            while (reader.Read())
            {
                pts_stockout_log outItem = new pts_stockout_log
                {
                    stockout_id      = (int)reader["stockout_id"],
                    packing_cd       = reader["packing_cd"].ToString(),
                    process_cd       = reader["process_cd"].ToString(),
                    issue_cd         = (int)reader["issue_cd"],
                    stockout_date    = (DateTime)reader["stockout_date"],
                    stockout_user_cd = reader["stockout_user_cd"].ToString(),
                    stockout_qty     = (double)reader["stockout_qty"],
                    real_qty         = (double)reader["real_qty"],
                    received_user_cd = reader["received_user_cd"].ToString(),
                    comment          = reader["comment"].ToString(),
                    remark           = reader["remark"].ToString(),
                };
                listStockOutItem.Add(outItem);
            }
            //Close reader and connection
            reader.Close();
            SQL.Close();
        }
Example #26
0
        /// <summary>
        /// Search list stock out item with date
        /// </summary>
        /// <param name="fromDate">From stock out date</param>
        /// <param name="toDate">To stock out date</param>
        public void Search(DateTime fromDate, DateTime toDate)
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            //Open SQL connection
            SQL.Open();
            //SQL query string
            query  = "SELECT stockout_id, packing_cd, process_cd, issue_cd, stockout_date, stockout_user_cd, stockout_qty, ";
            query += "real_qty, received_user_cd, comment, remark FROM pts_stockout_log WHERE 1=1 ";
            query += "AND stockout_date >='" + fromDate.ToString("yyyy-MM-dd") + "' ";
            query += "AND stockout_date <='" + toDate.ToString("yyyy-MM-dd") + "' ";
            query += "ORDER BY stockout_id";
            //Execute reader for read database
            IDataReader reader = SQL.Command(query).ExecuteReader();

            //Clear query
            query = string.Empty;
            //Read data into list
            while (reader.Read())
            {
                pts_stockout_log outItem = new pts_stockout_log
                {
                    stockout_id      = (int)reader["stockout_id"],
                    packing_cd       = reader["packing_cd"].ToString(),
                    process_cd       = reader["process_cd"].ToString(),
                    issue_cd         = (int)reader["issue_cd"],
                    stockout_date    = (DateTime)reader["stockout_date"],
                    stockout_user_cd = reader["stockout_user_cd"].ToString(),
                    stockout_qty     = (double)reader["stockout_qty"],
                    real_qty         = (double)reader["real_qty"],
                    received_user_cd = reader["received_user_cd"].ToString(),
                    comment          = reader["comment"].ToString(),
                    remark           = reader["remark"].ToString(),
                };
                listStockOutItem.Add(outItem);
            }
            //Close reader and connection
            reader.Close();
            SQL.Close();
        }
Example #27
0
        /// <summary>
        /// Add an user position
        /// </summary>
        /// <param name="inItem">input user position</param>
        /// <returns></returns>
        public int Add(m_user_position inItem)
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            //Open SQL connection
            SQL.Open();
            //SQL query string
            query  = "INSERT INTO m_user_position(user_position_cd, user_position_name, registration_user_cd) ";
            query += "VALUES('" + inItem.user_position_cd + "','" + inItem.user_position_name + "','";
            query += inItem.registration_user_cd + "') ";
            //Execute non query for add item
            int result = SQL.Command(query).ExecuteNonQuery();

            query = string.Empty;
            //Close SQL connection
            SQL.Close();
            return(result);
        }
Example #28
0
        /// <summary>
        /// Update an item
        /// </summary>
        /// <param name="inItem"></param>
        /// <returns></returns>
        public int Update(pts_item inItem)
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            //Open SQL connection
            SQL.Open();
            //SQL query string
            query  = "UPDATE pts_item SET type_id='" + inItem.type_id + "', item_cd='" + inItem.item_cd + "', item_name='";
            query += inItem.item_name + "', item_location='" + inItem.item_location + "', item_unit='" + inItem.item_unit;
            query += "', lot_size ='" + inItem.lot_size + "', wh_qty ='" + inItem.wh_qty + "', wip_qty ='" + inItem.wip_qty;
            query += "', repair_qty ='" + inItem.repair_qty + "', registration_user_cd ='" + inItem.registration_user_cd;
            query += "', registration_date_time = now() where item_id ='" + inItem.item_id + "'";
            //Execute non query for read database
            int result = SQL.Command(query).ExecuteNonQuery();

            query = string.Empty;
            return(result);
        }
Example #29
0
        /// <summary>
        /// Add new plan
        /// </summary>
        /// <param name="inItem">input plan info</param>
        /// <returns></returns>
        public int Add(pts_plan inItem)
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            //Open SQL connection
            SQL.Open();
            //SQL query string
            query  = "INSERT INTO pts_plan(plan_cd, destination_cd, model_cd, set_number, plan_date, plan_usercd, plan_qty, delivery_date, comment) ";
            query += "VALUES('" + inItem.plan_cd + "','" + inItem.destination_cd + "','" + inItem.model_cd + "','" + inItem.set_number;
            query += "','" + inItem.plan_date.ToString("yyyy-MM-dd") + "','" + inItem.plan_usercd + "','" + inItem.plan_qty;
            query += "','" + inItem.delivery_date.ToString("yyyy-MM-dd") + "','" + inItem.comment + "')";
            //Execute non query SQL
            int result = SQL.Command(query).ExecuteNonQuery();

            query = string.Empty;
            SQL.Close();
            return(result);
        }
Example #30
0
        /// <summary>
        /// Update a plan
        /// </summary>
        /// <param name="inItem">input plan info update</param>
        /// <returns></returns>
        public int Update(pts_plan inItem)
        {
            //SQL library
            PSQL   SQL   = new PSQL();
            string query = string.Empty;

            //Open SQL connection
            SQL.Open();
            //SQL query string
            query  = "UPDATE pts_plan SET plan_cd ='" + inItem.plan_cd + "', destination_cd ='" + inItem.destination_cd + "', model_cd ='" + inItem.model_cd;
            query += "', set_number ='" + inItem.set_number + "', plan_date ='" + inItem.plan_date.ToString("yyyy-MM-dd");
            query += "', plan_usercd ='" + inItem.plan_usercd + "', plan_qty='" + inItem.plan_qty;
            query += "', delivery_date ='" + inItem.delivery_date.ToString("yyyy-MM-dd") + "', comment ='" + inItem.comment + "' ";
            //Execute non query SQL
            int result = SQL.Command(query).ExecuteNonQuery();

            query = string.Empty;
            SQL.Close();
            return(result);
        }